1

Scenario:

A wants to send data to B on port 12345.

B needs port forwarding so it can receive the incoming connection.

Is there any way that B can receive the data without port forwarding?

Hole punching does need a server in the middle. So is there any other way so it doesn't need to have a server in the middle?

UPNP isn't a good option because as i read it requires the router to have it enabled.

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
Majx
  • 131
  • 14
  • 4
    "B needs port forwarding" is part of your scenario, so by definition the answer to your question is no. – Blorgbeard Nov 24 '17 at 19:37
  • What do you imagine exactly about sending data to B instead of forwarding ? – lucky Nov 24 '17 at 19:39
  • My question is. If B can't or don't know how to forward a port, is there any other way to send the data? – Majx Nov 24 '17 at 19:40
  • what exactly are you trying to do? – Jonathan Applebaum Nov 24 '17 at 19:50
  • Sending string form a client to another on a specific port without needing to port forward for the receiver client. Something like this [C# How to send string via UDP without Port Forwarding?](https://stackoverflow.com/questions/44281967/c-sharp-how-to-send-string-via-udp-without-port-forwarding) . But as I mentioned, Hole punching wouldn't work because it requires a server in the middle. – Majx Nov 24 '17 at 19:57
  • 1
    Make B initiate the connection. – Blorgbeard Nov 24 '17 at 21:29

2 Answers2

2

Its not possible (as far as i know) to pass packets between 2 clients that do not share the same network without referencing port number. and it does not matter whether it is TCP or UDP.
every data that you sent from your computer, is converted and wrapped as a packet - always!
it does not matter what programming language you are using because it happens in the Network and Transport layers according to the OSI model

a network packet must contain:

  • source IP
  • Source Port
  • Destination IP
  • Destination Port

a little analogy i can think about for better understanding:

Imagine that you want to visit a friend in a foreign country.
You know which country to fly (external ip address)
and you know your friend address in this country (internal ip address).
but when you arrive you dont know which train to take in order to reach your freind`s home (port number).
so without knowing the exact train (port number) there is no way that you will be able to visit your friend.
if you go and ask the information station (the router) in the airport and this train number realy exist (the route map / port forwarding configuration) they will direct where is the train that you need to take and you will be able to visit you friend.

that is the reason why you must configure port forwarding in the router - in order to update the route map

Jonathan Applebaum
  • 5,738
  • 4
  • 33
  • 52
0

I'm also trying the same thing to make a cod4 server without port forwarding I tried to use UPNP but in my router that is disabled, so I have the same problem.

I think we should try Steam port which is (27036).

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 21 '23 at 14:33