Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1305673 Posts in 58318 Topics- by 49420 Members - Latest Member: AdamBallard

July 25, 2017, 04:53:32 am

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityCompetitionsVersus (Moderator: Melly)Port forwarding: Discussion about port use
Pages: 1 [2]
Print
Author Topic: Port forwarding: Discussion about port use  (Read 14869 times)
eva
BANNED
Level 6
*


View Profile
« Reply #20 on: January 19, 2011, 02:18:18 pm »

hmm well it crashes when both my server/client apps sending a udp packet to each other on one port (im testing on one computer)
Logged

Sos
Level 8
***


I make bad games


View Profile WWW Email
« Reply #21 on: January 19, 2011, 02:19:57 pm »

ur dum, you need two ports to interface two apps on one PC, each needs it's separate port
Logged

eva
BANNED
Level 6
*


View Profile
« Reply #22 on: January 19, 2011, 02:21:53 pm »

o ok then i gona hav to go with multipl ports then ;/
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW Email
« Reply #23 on: January 19, 2011, 03:04:52 pm »

I can't tell how much of this discussion is genuine and how much is trolling, but you should only need one port to run two instances of an app on one machine and have them connect to each other. Assuming you're behind a router, the client should connect to IP 192.168.1.x (or similar) using whichever port the server specified.
Logged

Riley Adams
Level 5
*****


I don't actually use Ubuntu much...


View Profile
« Reply #24 on: January 19, 2011, 03:13:44 pm »

I can't tell how much of this discussion is genuine and how much is trolling, but you should only need one port to run two instances of an app on one machine and have them connect to each other. Assuming you're behind a router, the client should connect to IP 192.168.1.x (or similar) using whichever port the server specified.

Or just use the loopback/localhost address (127.0.0.1).
Logged

mewse
Level 6
*



View Profile WWW
« Reply #25 on: January 19, 2011, 03:42:15 pm »

hmm well it crashes when both my server/client apps sending a udp packet to each other on one port (im testing on one computer)

Apologies, Eva, I should totally have thought of that common situation!

Yes, you ordinarily can't have two programs using the same network port on one computer.

For testing on a single computer, I'll usually have a program try to bind its socket to port 'n', and then if that fails, have it instead try to bind to port 'n+1'.  And then attempt to send its packets to whichever port it's not using, itself.  That way I don't even have to think about issues with sockets;  I can just run two instances of my program and they'll figure it all out by themselves.
Logged
eva
BANNED
Level 6
*


View Profile
« Reply #26 on: January 19, 2011, 05:29:33 pm »

using multipl ports so the crash is gone but my udp packets arent bein sent or recievd or somthing i have no idea.. i'll figur it out............................nvm i got it so watch out cos "IM GONNA KICK UR ASS"  - hank hill

I can't tell how much of this discussion is genuine and how much is trolling, but you should only need one port to run two instances of an app on one machine and have them connect to each other. Assuming you're behind a router, the client should connect to IP 192.168.1.x (or similar) using whichever port the server specified.

U D P
ur dum protocol
« Last Edit: January 19, 2011, 06:10:22 pm by eva » Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW Email
« Reply #27 on: January 19, 2011, 06:41:55 pm »

I don't get it. Maybe I'm doing something wrong? I can run two instances, use the same port number for both the server and the client, and get correct result. With UDP.

For whatever reason, though, the loopback address doesn't work; I have to use the actual internal IP of my machine (or use my external IP and enable port forwarding).
Logged

eva
BANNED
Level 6
*


View Profile
« Reply #28 on: January 19, 2011, 07:04:07 pm »

have ya tried sending each other a udp packet
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW Email
« Reply #29 on: January 19, 2011, 07:37:42 pm »

Nah, just arbitrary text data. I guess I was assuming Winsock would translate it into a UDP packet under the hood, but maybe that's not the case?
Logged

Oddball
Level 10
*****


David Williamson


View Profile WWW
« Reply #30 on: January 19, 2011, 07:39:14 pm »

I am able to use the same port for multiple instances of the same app, and everything works fine. I use it for testing as local host doesn't catch router problems.
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW Email
« Reply #31 on: January 19, 2011, 09:44:50 pm »

For whatever reason, though, the loopback address doesn't work; I have to use the actual internal IP of my machine (or use my external IP and enable port forwarding).

Oh, hurr, I get it now.

If I want to use the loopback address, the server has to bind the socket to that address, which precludes it from binding that same socket to another address.

I was just assuming that some magic would happen to match up the client's attempt to connect to the loopback address with the server's internal IP binding, but it seems that's not the case.
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic