Handling TCP and UDP in same server
Hi, i need to create a server that handles both tcp and upd
so i have like:
ServerSocket tcpServer = new ServerSocket(port) // for tcp connection
....
DatagramSocket udpServer = new DatagramSocket(port) // for udp connections
What I want to know is how can I check if im receiving a TCP connection or a UDP connection ?
ex:
if(tcpConnection){ //do things}
...
if(udpConnection){ //do other things }
Re: Handling TCP and UDP in same server
The ServerSocket blocks until it receives a connection.
I don't know what the DatagramSocket does.
Do you have a small simple client/server program that would demonstrate this problem?
Re: Handling TCP and UDP in same server
Well you certainly can't use the same port.... so you are going to have to use one for the UDP server and the another one for the TCP one!