Results 1 to 10 of 10

Thread: Connection to computer.

  1. #1

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Connection to computer.

    I've made a card game which can be played with another player through a net (or against the machine). It can also be played against a friend through Internet... but only if both IPs are public (obviously)

    Does anybody know how to create a NAT through VB?. I mean... I need an external computer to get connected to an enterprise's computer (for example, which has a private and public IP)
    Last edited by Mc Brain; Mar 21st, 2002 at 06:50 PM.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  2. #2

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    ^BUMP^
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  3. #3
    sunnyl
    Guest
    Well...NAT being the way it is, there is no way to connect to a computer behind NAT unless that computer initiated the connection, or unless a port has been opened and mapped to the right computer listening.

  4. #4

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Let's say the computer behind the proxy (or whatever) initiated the connection... what's next?
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  5. #5
    sunnyl
    Guest
    Then the connection will happen normally, there is nothing different from a normal connection afterwards.

    Its upto the NAT device to figure out which computer the incoming packet is destined for. You don't need to specify anything when sending.

  6. #6

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Not so quite. I don't understand all of it. If I get a "pacakage" (sent by this behind-proxy machine) I can get the IP that sent it, and use this to reply?
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  7. #7
    sunnyl
    Guest
    Yup, you just use that IP. Lets just say a connection happens with a machine behind NAT:

    1) A port is opened, and mapped to a machine behind NAT, which has a program listening on that port.

    2) Another program connects to the IP address of the NAT device on the mapped port, the NAT device will 'pass on' the connection request to the computer that has that port mapped to it. Then, the two computers connect.

    3) When data is sent out of the behind NAT machine, the NAT device reads the packet, and modifies the header so that the packet will look like it came from itself and not the machine behind it. At the same time, it keeps track of packets that have left.

    4) When data comes back in, the NAT device checks against its records whether the incoming packet is a reply from a previously established connection destined for a computer in the network. If it is, then the NAT device modifies the header of the packet to the private IP of the machine that it should go to.

    Basically, it will just modify outgoing packets so that it will look like the packet came from itself, then modify incoming packets so that it will go back to the right computer in the network.

  8. #8

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Ok... I will test that, then. I'll let you know if something doesn't work.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  9. #9

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Didn't work

    I'm using this code... but it doesn't work:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     udpPeer.SendData "Hello...."
    5. End Sub
    6.  
    7. Private Sub udpPeer_DataArrival(ByVal bytesTotal As Long)
    8.     Dim Data As String
    9.     udpPeer.GetData Data
    10.  
    11.     MsgBox udpPeer.RemoteHost & "(" & udpPeer.RemoteHostIP & ")"
    12. End Sub
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  10. #10

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    anyone?
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

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