Socket problem

georgepatotk

Contributor
Joined
Mar 1, 2004
Messages
432
Location
Malaysia
Dear all,

I am a big doubt which I had thought for few weeks.. Hope that u could help me in solving this problem.

I am writing a server client application where as usual server is to listen to the request from client.

For each connection with the server, the client are able to receive data based on the request command from the client.
For example:
1. Client send "GETNAME"
server response and send to client a list of user name in ListBox format

2. client send "GETAGE George"
server will response and send to the client the age of George in numeric format

3. Client send "GETALLDETAIL"
server will response and send a list of data in datagrid format

In different situation, server will response and send different type of data to client, in what way could I write a program in such manner? Please help me.

And in addition, can I send an ICollection thru the network? If can, how is it going to be done?
 
I don't see any reason why you couldn't do that. If you haven't gotten into sockets, I'd read through MSDN topics "Using a Synchronous Server Socket", "Using a Synchronous Client Socket" and the asynchronous counterparts "Using an Asynchronous Server Socket" and "Using an Asynchronous Client Socket".

Mike
 
why reinvent the wheel? look into .NET Remoting
MarshalByRef objects
passing serializable objects by value - you get a wide range of configuration options. Binary, Soap, Http, TCP even custom protocols and formatting layers.
 
Yea, as I could find out, there is a class called serializable in .Net. Very usefull tool in sending things over network. Thanks for your resposes.
 
I have a new doubt in this topic.

I am sending networkstream with the format shown below to the server. Can anyone tell me how to combine these two objects into one byte array in the client and how to break them in te server?

FORMAT:
command(0-511) & serialized dataset(512 - dataset size+512)

Please help me, i need this urgently.
 
Back
Top