General Sockets Questions (with typo's fixed)

  • Thread starter Thread starter ZorpiedoMan
  • Start date Start date
Z

ZorpiedoMan

I'm new to the world of sockets, and this question is not VB specific:

If multiple clients access the same server on the same port, and the server
is set up to do some async communication, does the server's response GO back
to
all the clients on that port, or just to the one who sent the request?

In other words:

Client One - Request Data From Server (It takes a few seconds for the server
to get the answer)
Client Two - Requests Data From Server (this also takes a couple seconds)

The server, on two asyncy threads is processing both requests.
It gets the results for one of the clients and sends the RESULT back up the
socket it is holding for that client.

(here's the question:)

Do both clients 'see' this result and have to determine if it belongs to
them, or does a socket object somehow encapsulate the communication, so that
only the calling client will get the answer?

Hope this question makes sense and someone knows the answer!

thanks.
 
ZorpiedoMan said:
I'm new to the world of sockets, and this question is not VB specific:

If multiple clients access the same server on the same port, and the
server is set up to do some async communication, does the server's
response GO back to
all the clients on that port, or just to the one who sent the request?

In other words:

Client One - Request Data From Server (It takes a few seconds for the
server to get the answer)
Client Two - Requests Data From Server (this also takes a couple seconds)

The server, on two asyncy threads is processing both requests.
It gets the results for one of the clients and sends the RESULT back up
the socket it is holding for that client.

(here's the question:)

Do both clients 'see' this result and have to determine if it belongs to
them, or does a socket object somehow encapsulate the communication, so
that only the calling client will get the answer?

Hope this question makes sense and someone knows the answer!

thanks.

Your question makes perfect sense :) Basically, the answer is that each
connection to the server results in a new socket that then handles all
communication to the connected client. In this way, responses are unique
to each client. There are several good examples of using async sockets in
the .NET help. I would look those up and study them.

Tom Shelton
 
Hi,

Thanks for your post.

Tom in right here. A socket is a communication endpoint ¡ª an object
through which a Windows Sockets application sends or receives packets of
data across a network. A socket has a type and is associated with a running
process, and it may have a name. Currently, sockets generally exchange data
only with other sockets in the same "communication domain", which uses the
Internet Protocol Suite.

In Socket programming, server listens on a specific port. When it receives
a connection from a client, it will spawn a new socket and communicate with
that client on that new socket. So each client is communicating with server
in a private channel. They won't impact each other.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
Back
Top