TCP Layer problems

Started by
11 comments, last by jsaade 16 years, 6 months ago
I am now using a mix of tcp and udp sockets on the host and server.
this means having a tcp socket listening for connection requests and communicating via slave sockets and a udp socket for udp messages (Send/recv).
I have read in many places on the forum that i could have the tcp and udp sockets on the same port. my problem is that when a client sends messages via udp to the server address, the tcp socket on the Client shows there is pending data and gets that data. I am do not know how this is possible unless i am missing some important option.
Advertisement
Quote:when a client sends messages via udp to the server address, the tcp socket on the Client shows there is pending data and gets that data


That's not possible. It has to be happening some other way. Are you using straight WinSock, or some library? No matter which, trace through the code, and see how you call socket(), to make sure you get two separate protocols. Also, when sending, make sure you send on the socket you think you're sending on.
enum Bool { True, False, FileNotFound };
ignore that, it was caused by an engine bug and my lack of sleep. thanks for your help.
anyways everything seems running smoothly now.
What i want to add is that for tcp, i found it is faster to associate the socket with a buffer.
when there is data to be read (via select), then read all the pending data onto the buffer, then fragment that data into packets. if some data still remains and a packet needs more info to be constructed (i.e. the fragment size is less than the size of the header, or less than the packet's size), then the next check would read the remaining data and add it to the content of the buffer thus constructing the packet.



[Edited by - ZeRaW on October 26, 2007 9:25:45 AM]

This topic is closed to new replies.

Advertisement