CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Posts
    5

    Using x receive and send sockets + IOCP

    Hi all,

    Im currently working on a new version of my client application who´s sole purpose is to query massive ammounts of servers for there status. All data for this subject will be transfered over UDP.

    Basicly it goes like this: I send the request and The server responses with 1 or more packets.

    Now before i start designed the application i was hoping anyone of you could tell me if it is possible to use a specific ammount of sockets who listen for incoming data from any random source?

    I know this is possible when creating a server application since then your can listen to a given port and the client always have to send there requests to that port. however when creating a client, my send sockets send the data through their own port and the servers send their responses back to that port. Is it possible to modify the send in that way that the senders port will be the one used by a receiver socket?

    Thanks in advance!

    Koen

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Using x receive and send sockets + IOCP

    Do you have control of the server code? If so, you can always piggyback a port number on the query of the port you'd like the response to use.

    If not, then---assuming I'm understanding the question---it should certainly be possible to specify the client port used, rather than letting it be assigned randomly as usually happens.

  3. #3
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: Using x receive and send sockets + IOCP

    Quote Originally Posted by DV6
    .... Is it possible to modify the send in that way that the senders port will be the one used by a receiver socket?
    What benefit do you hope to obtain by doing so?

    Mike

  4. #4
    Join Date
    Aug 2007
    Location
    Birmingham, UK
    Posts
    360

    Re: Using x receive and send sockets + IOCP

    When you receive a UDP datagram you can check from which IP address and port number it came and use that information to send the answer back to where the initial datagram came from.

    Is that what you are looking for?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured