So, with select and the ISSET macro. This checks to see if the socket descriptor in question has activity on it and if it does then the recv function is called to get that data after it has been sent. So with this there is not an immediate threat with blocking problems, correct? or will I need to set the socket to non-blocking and when i need to recieve something loop until the number of bytes recieved is different and that would be the message?
That sounds right... only I want them to be a server and a client... but alternating is exactly what I need...
Originally posted by _Cl0wn_
You won't need as much. You would probably only need one file to do it. You would just need to set up a menu at start up where the user can make a choice to become the server or client. If he wants to be a server then bind and listen else then he wants to be a client and then just connect to the server NOTE: the server would already need to be up to connect to. Then you could either user a while loop of send and recv or use select. I have found something that should help you with what you are doing.
I want it to send the 5 character string to the other server, which they can then send it back... its for a chess game, actually. Until we finish the mouse input, its based off of a character string representing coordinates: "a1:a3", which we want the other computer to receive, and then be able to send.
Is this what that link does?
If you're using select(), you don't _need_ non-blocking.
What ever you do, remember that TCP/IP provides data to your program as a byte stream, with as many breaks in it as it likes. By this I mean, a call to recv() could yield 1 byte of data, the next call another 3 bytes, and the next another 10. These 14 bytes together might make-up the user name supplied by send() in the client, but it's your job to concatenate them correctly.
thanks a bunch! This is going to make life easier!
(the only "network" I knew how to do was put a text file and have it constantly read it... that would work some of the time... as long as everyone has read/write access to that file.)
Ok...I have the screen name deal working now, in that it is sent but now Windows crashes when it is run.