For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2006 > Help needed in a simple UDP socket program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help needed in a simple UDP socket program
Vitali Gontsharuk

2006-05-15, 7:08 pm

Hi!

I have a problem programming a simple client-server game, which is
called pingpong ;-)
The final program will first be started as a server (nr. 2) and then as
a client. The client then sends the message "Ping" to the server, which
reads it and answers with a "Pong".
The game is really simple and the coding should be also very simple! But
for me it isn't.
By the way, the program uses datagram sockets (UDP). And, I'm using
Cygwin (don't think the problem occurs due to that).
What the program now does is, upon the client start, to send the "Ping"
message to the server, which in turn sends an answer to the client. The
"sendto" invoked in the start_server() function deliveres the length of
the used buffer "mesg" as a result - but the message can't be received
by the client, the execution blocks!
It must be an easy to solve problem, but I'm now at the end of my nerves
and can't see what the problem is.
If you could help me, I would really appreciate that!

Thanks in advance,
Vitali Gontsharuk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com