handling multiple client requetts independenly

zakia

New member
Joined
Aug 6, 2012
Messages
2
Programming Experience
1-3
I'm developing a asynchronous multiple client server application using tcp sockets in c#... i have to multiple clients connected over wifi and each client sending different type of data(file,image,video, voice) ... now i need to develop a server application that accomodate all request independenly.... how can i identify multiple client connections and which client is sending what data and how then process it in a single server application code.
i need help to resolve this...
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,219
Location
Sydney, Australia
Programming Experience
10+
You would define a class to represent a connected client and the Socket would be assigned to one of its properties. You know which client is sending data because it's the Socket for that client that you receive data via. As for what type of data is being sent, the client would have to send a header so that the server knows how to interpret what follows.
 

zakia

New member
Joined
Aug 6, 2012
Messages
2
Programming Experience
1-3
how can i specify the data-header

You would define a class to represent a connected client and the Socket would be assigned to one of its properties. You know which client is sending data because it's the Socket for that client that you receive data via. As for what type of data is being sent, the client would have to send a header so that the server knows how to interpret what follows.


Thanks for your immediate reply... But can you please guide bit more on format for sending metadata/header for tcp-socket to be sent/received on both side.. is there any standard format?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,219
Location
Sydney, Australia
Programming Experience
10+
It's completely up to you. You might need as little as a single Byte to indicate the type of data. You might also need to specify the size of the data being transmitted. It's up to you to determine what else you might need and how to format it.
 
Top Bottom