so i dived in to sockets to play with them but i cant figure them out can anyone help me with a server and client setup though sockets
edit: if this doesnt go here move it.
so i dived in to sockets to play with them but i cant figure them out can anyone help me with a server and client setup though sockets
edit: if this doesnt go here move it.
Last edited by austin2162; 08-18-2011 at 05:35 AM.
~Austin~
What language? If C++, Boost's ASIO is too cool.
in simba.
~Austin~
Have you read this yet?
i did read that but im still struggling
~Austin~
Well, I can't provide you with a fully working example right away. But something to get you started:
SocketClient:
Simba Code:program new;
var sock: integer;
begin
sock := CreateSocket();
ConnectSocket(sock, 'localhost', '9001');
sendsocket(sock, 'hi'#10#13);
closesocket(sock);
end.
Tested with: (run the nc command first, not sure if Windows has something similar)
E: Netcat for windows: http://joncraton.org/blog/46Code:$ nc -l -p 9001 localhost hi
Server:
Simba Code:program new;
var
serv, sock: integer;
s, ip, port:string;
begin
serv := CreateSocket();
setsockettimeout(serv, 50000);
BindSocket(serv, '0.0.0.0', '1504');
ListenSocket(serv);;
sock := AcceptSocket(serv);
setsockettimeout(sock, 50000);
writeln(recvsocketstr(sock));
end.
Tested with telnet:
Code:$ telnet localhost 1504 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. HELO Connection closed by foreign host.Hope it helps. I didn't fully figure it out myself yet. Dgby knows a lot more on this.Compiled succesfully in 100 ms.
HELO
Successfully executed.
Last edited by Wizzup?; 08-20-2011 at 09:23 AM.
The best way to contact me is by email, which you can find on my website: http://wizzup.org
I also get email notifications of private messages, though.
Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
Documentation | Source | Simba Bug Tracker on Github and Villavu )
My (Blog | Website)
And if you mean player information. Yes, I already have some functions started for it.
There are currently 1 users browsing this thread. (0 members and 1 guests)