#include "TCP.au3"
ToolTip("SERVER: Creating server...",10,30)
$hServer = _TCP_Server_Create(88); A server. Tadaa!
_TCP_RegisterEvent($hServer, $TCP_NEWCLIENT, "NewClient"); Whooooo! Now, this function (NewClient) get's called when a new client connects to the server.
_TCP_RegisterEvent($hServer, $TCP_DISCONNECT, "Disconnect"); And this,... this will get called when a client disconnects.
While 1
WEnd
Func NewClient($hSocket, $iError); Yo, check this out! It's a $iError parameter! (In case you didn't noticed: It's in every function)
ToolTip("SERVER: New client connected."&@CRLF&"Sending this: Bleh!",10,30)
_TCP_Send($hSocket, "Bleh!"); Sending: "Bleh!" to the new client. (Yes, that's right: $hSocket is the socket of the new client.)
EndFunc
Func Disconnect($hSocket, $iError); Damn, we lost a client. Time of death: @Hour & @Min & @Sec :P
ToolTip("SERVER: Client disconnected.",10,30); Placing a tooltip right under the tooltips of the client.
EndFunc
in the function "ToolTip("SERVER: Client disconnected.",10,30); Placing a tooltip right under the tooltips of the client."
As you can get the ip of the user disconnects ?
I tested with "_TCP_Server_ClientIP()" but it does not work and the result is 0
Any idea or solution...