Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411196 Posts in 69314 Topics- by 58380 Members - Latest Member: feakk

March 18, 2024, 08:17:43 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityJams & EventsCompetitionsVersus (Moderator: Melly)Port forwarding: Discussion about port use
Pages: 1 [2]
Print
Author Topic: Port forwarding: Discussion about port use  (Read 22944 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
« 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
« 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
« 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
« 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
« 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