Re: VB.NET Socket - Multiple clients to server

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: William Stacey [MVP] (staceywREMOVE_at_mvps.org)
Date: 08/18/04


Date: Wed, 18 Aug 2004 10:50:43 -0400

A socket is unique with 4 pieces of info:
1) server ip
2) server port
3) client ip
4) client port

So you have many sockets all connecting to same server ip and port as long
as client ip/port is different, which they will be. If the same client trys
to connect with same local port twice, it will fail locally trying to grab a
local socket that is using same ip and port (IIRC).

-- 
William Stacey, MVP
"User" <guest@guest.com> wrote in message
news:OPJUc.25312$X12.22077@edtnps84...
> I thought that a port number was unique to one socket?  Is that right?
>
> In my implementation, I use the port number as an identifier for the
> client connection.  If I use one socket, is there a unique identifier
> for any accepted connection?
>
> Thank you!
>
>
>
> Jon Skeet [C# MVP] wrote:
>
> > User <guest@guest.com> wrote:
> >
> >>I tried to find the information over the internet but didn't find any
> >>answers.
> >>
> >>I'm looking for a server side code example of winsock accepting many
> >>clients.  I know that in VB.NET it is not implemented like in VB6.  What
> >>I've done is one client per socket.  Meaning that each client used a
> >>different port on the server, but I find it annoying.
> >>
> >>I would like to have all clients to connect to the server using one
port.
> >
> >
> > Just because they're using different sockets doesn't mean that clients
> > have to connect to different ports. Just use TcpListener and call keep
> > AcceptTcpClient or AcceptSocket and everything will be fine.
> >
>


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)