Winsock / Sockets programming



Working with Winsock


I am making this post because I need help with Winsock Programming.

About the application: I want to create a client/server application.
At the client side receive message from the server only, send message
to the server only. In the Server side receive message from all the
clients, broadcast message, and send message to individual clients.

So far, I have read some information about Winsock, and I have managed
to create in a dialog application the win console application example
on.

http://www.codeproject.com/KB/cpp/chat_client_server.aspx

But I am having problem when I want to create different sockets so
allocate it to more than one machine.

The 2 problem I am facing now is I am not sure if I should create one
socket on one port. And connect everybody to that socket like a big
chat room and do the sorting/find at the CString buffer, the problem I
see is that all the end user will need to be looking for their message
in a big CString buffer.

The second approach will be create socket to each client (at this
point I am not sure if you can create more than one socket attached to
the same port, remember I want to sent message to a unique client at a
time. In my try application if I don’t disconnect/destroyed the socket
and create it again when I receive a message from the server I receive
it twice, telling me I can have more that one socket to attached at
the same port, but I am not sure if I can send it to a particular
socket or it just broad cast because it is attached to the same port.)
I could allocate a port and a socket to each client so every one has
his own socket and port attached, but this approach could ending me up
with a server that need to be looking for 200+ ports

Let discuss this problem only here because the second problem depend
on what approach I go ahead.

Thank you for your help,

Regards
.



Relevant Pages

  • Re: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Unable to print to networked printer - get access denied messa
    ... Check the permissions on the server assuming the client has a true RPC ... How is the Standard TCP/IP port configured for the device? ...
    (microsoft.public.windowsxp.print_fax)
  • Re: interfaces lo:1 lo:2 lo:3? (for remote ssh tunnels)
    ... That's the problem tunneling (port forwarding) solves. ... >>can't get past the client firewall. ... > I don't understand why the server would be making the ... server initiates another connection to the client -- in this ...
    (Debian-User)
  • RE: call is blocked in recvfrom() and no further proceedings in Win CE
    ... In windows CE, I'm able to send a request but I'm unable to receive it. ... Create another socket & bind with server IP address. ... > My program has to send request to service through port 5070(in this port only ...
    (microsoft.public.windowsce.embedded)
  • Re: Remote Connection Issue
    ... through port number 3389 and a workstation on the LAN through port number ... I understand that you want to allow a LAN client ... and you have configured server publishing rule ... > By default Terminal Server and Windows 2000 Terminal Services uses TCP ...
    (microsoft.public.windows.server.sbs)