Re: How to uniquely identify a UDP session at Winsock layer?



For UDP, once a send is done, the socket will be auto-bound if it has not
been previously bound. After which time you may call getsockname() to find
out where it got bound to. Of course if you want to make sure to bind it to
a particular interface you can just do that by calling bind() to explicitly
bind the socket the interface you want.

Thanks,
- Omar

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send
email directly to this alias. This alias is for newsgroup purposes only.



"ganesan" <ganesan.nagrajan@xxxxxxxxx> wrote in message
news:1115922401.192064.115530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi all
>
> I had posted a question on Winsock UDP. Probably its wasn't corretly
> stated.
>
> This is what I am looking for.
>
> Theoretically, I guess, a connection or session in uniquely identified
> by "Source IP, Source port, Destination IP, Destination port".
>
> If you are below the TCP/IP stack you will get these for any
> adapter(both for TCP and UDP).
>
> When you are at Winsock or LSP level, we may not able to know which
> adapter is used for connection, if there are mulpitle adapters running
> simultaneously. Of course in case of TCP once the connection is done
> using WSPConnect() call, we can use the getsockname(),
> WSPGetSockName(), gethostbyname() etc. calls to find the correct
> source IP address and port used for that particular connection.
>
> But for UDP, it may not be the case. User just creates a socket() and
> calls Sendto(). The call socket() doesn't establish any connection i
> guess. So when a sendto() call is made, i don't know which adapter is
> used for sending the data and thus i don't know the local IP and port
> used.
>
> So, How to uniquely identify a UDP session at the Winsock level,
> knowing that both sendto() and recvfrom calls() has only the remote
> host info?
>
> Thanks for any help.
>
> Ganesan
>


.



Relevant Pages

  • Re: SetSockOpt with SO_REUSEADDR parameter
    ... So I create multiple UDP sockets with the same port to send data. ... happening is that you are throwing away the old socket and replacing it with the new ... When the second client is connecting to server, I still get the error code ...
    (microsoft.public.vc.mfc)
  • Re: Communicating with a servlet using NIO?
    ... TCP/IP uses the same port number as the listening ... port for incoming connections. ... connection to it - all communication beyond the initial connection by ... and returns the descriptor for the new socket. ...
    (comp.lang.java.programmer)
  • Re: Definition of a socket on Suns website
    ... the server gets a new socket bound to a different port. ... It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client. ...
    (comp.lang.java.programmer)
  • Re: Socket and cycle problem
    ... listening this port countinously. ... So I need make some loop to print data from 3883 port permanent. ... the data it receives from each connection after the remote side drops ... If you were to use the socket module, then it would look something like this: ...
    (comp.lang.python)
  • Re: fork + socket -server fails
    ... If I use from either Expect or Tclx in combination with [socket ... On FC-4 I can telnet to port ... 8015 and the script prints out the expected "Accepted connection:" ... puts "Accepted connection: $args" ...
    (comp.lang.tcl)