17.04.2011, 16:36
https://sampforum.blast.hk/showthread.php?tid=171598 - Read before continuing
I am using it on my local host right now. However, it seems it cannot send information properly if it isn't the host (start_listening)
This is my code:
I have considered the order in which the 2 programs should start. In the right order, the server answers after 1 second with "yo", while the other server that is connected doesn't seem to receive anything as it doesn't execute the same. This indeed should create an endless loop of yo's.
Why isn't this happening?
I have no experience in reading plugin sources, otherwise I'd be doing that. I'd appreciate it if someone could.
I am on a windows 32-bit 7 ultimate edition. No firewalls blocking. Both server are hosted locally.
Nearly impossible to find a packet sniffer that reads localhost packets as most are purely for network analyzing.
I can't figure out whether it even reaches the server or not.
Thank you!
I am using it on my local host right now. However, it seems it cannot send information properly if it isn't the host (start_listening)
This is my code:
pawn Код:
... //This is the responding client
#include <sockets>
public OnSocketConnect(address[],port)
{
if ( strcmp(address, "127.0.0.1") != 0 ) // not a loacal connection!
{
socket_close();
}
return 1;
}
forward message();
public OnSocketReceive(data[], address[], port)
{
// do something
SetTimer("message",1000,false);
return 1;
}
public OnGameModeInit()
{
//socket_startlistening(7000);
socket_connect("127.0.0.1",7000);
socket_send("yo");
return 1;
}
public message()
{
socket_send("yo");
}
=============================
... //This is the server
#include <sockets>
public OnSocketConnect(address[],port)
{
if ( strcmp(address, "127.0.0.1") != 0 ) // not a loacal connection!
{
socket_close();
}
return 1;
}
forward message();
public OnSocketReceive(data[], address[], port)
{
// do something
SetTimer("message",1000,false);
return 1;
}
public OnGameModeInit()
{
socket_startlistening(7000);
//socket_connect("127.0.0.1",7000);
//socket_send("yo");
return 1;
}
public message()
{
socket_send("yo");
}
Why isn't this happening?
I have no experience in reading plugin sources, otherwise I'd be doing that. I'd appreciate it if someone could.
I am on a windows 32-bit 7 ultimate edition. No firewalls blocking. Both server are hosted locally.
Nearly impossible to find a packet sniffer that reads localhost packets as most are purely for network analyzing.
I can't figure out whether it even reaches the server or not.
Thank you!