- Home /
unity client is acessing from what port? (what port to set in router)
I'm trying to configure out the router we have at our house but I've came to a problem, I thought I only need to give it port from witch I'm receiving the messages, but now I see I need to give it port from what I will receive messages as well, ...
so, ... what should I choose? other applications? or...?
and that what should I give for from port? through port is probably 25001 and so is to port. right?
Server Script:
public int Port = 25001;
void Start(){
Network.InitializeServer(10, Port);
}
Client Script:
public string IP = "31.15.149.40"; // server IP
public int Port = 25001; // Open Port to server
void Start (){
Network.Connect(IP, Port);
}
and at protocol I should use TCP right?
there are options:
TCP
UDP
ESP
GRE
thanks in advance
Unity Networking uses UDP (even though it probably shouldn't)
Also Unity uses standardised protocols to automatically open ports. Usually you don't need to do port forwarding. Have you tried without?
well without would than mean for to router to send the data to all 10 computers in our house, ... and no it didn't work without.
BUT now I even know I must set them all alike.
even understand a bit more thanks to the answerer. Thought that client is trying to access 25001 on some else port.
NOW I know If I do it this way:
client
Network.Connect(IP, 20);
Server
Network.InitializeServer(10, 25001);
that I have to configure fritz box to forward port from 20 in to the port 25001.
and everything will work fine :)
thanks community on the hard subject networking.
Answer by Slobdell · Aug 22, 2013 at 11:17 PM
Yes UDP. The from port is the port you're expecting to receive on. The to port should probably just be the same. But what it's asking you is if you want to change the port along the way.
External application --> Router IP/Port --> destination in network IP/Port
If you wanted you could say any requests coming in the router on port 1, can be forwarded on to another machine at port 2. But in your case just keep them all the same since the server is listening on 25001 and the client is is trying to connect on 25001
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Networking how to return data? OR how to send only to 1 client 1 Answer
Combine two scripts 0 Answers