|
-
Mar 16th, 2002, 07:19 PM
#1
Thread Starter
Need-a-life Member
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.
-
Mar 16th, 2002, 10:24 PM
#2
Thread Starter
Need-a-life Member
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.
-
Mar 17th, 2002, 12:39 AM
#3
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.
-
Mar 17th, 2002, 01:28 AM
#4
Thread Starter
Need-a-life Member
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.
-
Mar 17th, 2002, 01:32 AM
#5
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.
-
Mar 17th, 2002, 01:37 AM
#6
Thread Starter
Need-a-life Member
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.
-
Mar 17th, 2002, 01:50 AM
#7
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.
-
Mar 17th, 2002, 01:55 AM
#8
Thread Starter
Need-a-life Member
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.
-
Mar 20th, 2002, 08:37 PM
#9
Thread Starter
Need-a-life Member
Didn't work
I'm using this code... but it doesn't work:
VB Code:
Option Explicit
Private Sub Command1_Click()
udpPeer.SendData "Hello...."
End Sub
Private Sub udpPeer_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
udpPeer.GetData Data
MsgBox udpPeer.RemoteHost & "(" & udpPeer.RemoteHostIP & ")"
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.
-
Mar 21st, 2002, 06:40 PM
#10
Thread Starter
Need-a-life Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|