Results 1 to 7 of 7

Thread: Managing Multiple Socket Connections Over WAN

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Managing Multiple Socket Connections Over WAN

    Alright so I have computer A,B,C

    Computer a resides on its own network. Computer B,C are on their own network together.

    So computer A is a server that recv's multiple socket connections at the same time from clients B,C over the internet. The issue for me is when they connect via TCP to the server each one socket the server handles each connection perfectly fine but when they both add a socket connection making 4 connections how can I make the server tell which sockets belong together in a group by Computer B, And Computer C, so I do not get them mixed up?! I do not want to send information to computer C that needs to go to B when feeding streaming information. Should I on connect send them a Large random number that they send through with every socket connection so I know that the new connection is coming from a existing computer that already connected? Ideally I would look for the IP being different but both of them coming from the same WAN address will not help in this case =(

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Managing Multiple Socket Connections Over WAN

    If B and C both connects to A, how does that create 4 connections?
    So your problem is basically, if they both are connected at the same time, you need to be able to identify them? What language are you using?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    58

    Re: Managing Multiple Socket Connections Over WAN

    Like for instance Lets say I got media I wanted to stream.
    like for instance two songs, JUST FOR EXAMPLE

    every time a socket connects it will download a different song.

    So if both computers B, C connect with two sockets each making four, How can A(The Server) detect a 2nd socket connection from each and stream the next media to that computer. make sense? Like if one was a video feed and other was a Sound feed?

    Language... Doesn't matter I can do it in anything from ASM to VC++ to vb.net, its not the language that seems to be the issue for me at hand its the protocol and identify that socket belongs what what other sockets to stream the media to the right place. But an Example if that's what you mean in any language will work =D.

    Is making a custom protocol what I need?
    Last edited by AgentSmithers; Aug 12th, 2009 at 03:44 PM.

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Managing Multiple Socket Connections Over WAN

    Aha, so computer B and C both create 2 connections each to the server. And you want to know what pair of connections on the server side belongs to the same computer?
    If I got it right, then there are multiple ways you could identify them I suppose.
    The computers could send something just after they've created the 2 connections that identifies the computer, such as the MAC address. However unique identifiers can be troublesome.
    Another solution is this:
    Imagine Computer A having a bunch of connections to it, and it does not know what pair of connections to group together. It could then take one connection randomly, lets say its one of Computer Bs connections, and send a number to it.
    Computer B would receive this number and respond by sending it back on the other connection. When Computer A receives this number on one of its many unidentified connections, it'll know that the two connections are connected to the same host and can group them together.

    Just an idea that came to me just now.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5
    Member
    Join Date
    Mar 2006
    Posts
    46

    Re: Managing Multiple Socket Connections Over WAN

    Lets see if I got this right...
    So everytime a computer connects for data they could use there harddrive serial number as a semi unique ID. That way you would have not only the IP address but the HD serial number so you "could" two computer apart even if there are connected behind the same router.
    Example 1 - Same router
    Computer B ip 123.45.67.89 HD 1234567890
    Computer C ip 123.45.67.89 HD 0987654321
    Example 2 - Different locations
    Computer B ip 123.45.67.89 HD 1234567890
    Computer C ip 98.76.54.32 HD 0987654321

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Managing Multiple Socket Connections Over WAN

    The MAC address would be a better unique ID than the HD serial number as MAC addresses have to be universally unique
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Managing Multiple Socket Connections Over WAN

    Quote Originally Posted by chris128 View Post
    The MAC address would be a better unique ID than the HD serial number as MAC addresses have to be universally unique
    I agree that using the MAC address as an identifier would be a better choice, however not even that is guaranteed to be unique as MAC addresses can be spoofed.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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