I am recently trying out the new unity networking solution which is netcode for gameobjects . In Unity using netcode for gameobjects i tried making a simple game which consist of a server and clients connecting to the server. I was able to make a simple game where my server was listening on "0.0.0.0:55000" and my clients were able to connect and send RPCs.So, for now everything was going fine and everthing worked fine in my local machine.
So, now i decided to run my unity game server in remote server and try to connect from my local machine.But , i was not able to connect to the remote server. I tried many things but failed to connect to my remote hosted server.
So, i would like to give you information about my server setup. So, i am using a "AWS EC2 instance Amazon Linux Server" for my game server. I have build a "dedicated server build for linux platform" from my unity editor as a X86 file , and i have transfered all the files to my aws server using FileZilla .
Then , i tried running my server which works fine . It was running fine which i confirmed by checking all of my network ports and connections data using "netstat" command on my amazon linux server. I used the command "netstat -ltu -pt" and i was able to see the name of my unity game server running and listening on TCP "0.0.0.0:55000". Screenshot of my amazon linux serevr netstat output
I also , allowed inbound TCP request on PORT "55000" from any source on my server by using the security settings on aws. Screenshot of my allowed inbound connections on my aws server
But, when i try to connect to my server form my local machine it fails to connect for some reason.
So,** PLS HELP ME ....WHY CAN'T I CANNOR CONNECT TO MY SERVER ???????????**
The first thing i wanted to confirm was that , is my remote server accessible from anywhere or not ?
SO, i did telnet "ipaddress of remote server" "55000" , from my local windows machine from my command prompt and i was able to confirm that my ports are open because i didnot get any "failed to connect to the server" messages.
I also tried doing a http post request on my remote server using POSTMAN , and i was able to get a message on the server, the message was a courrrpt message which i expected since i tried doing a http post request to my game server which does not handle any htttp requests.
This is the message i recieved on my game server console " The message header is corrupted and for security reasons connection will be terminated".
From the above experiements that i did i was able to confirm that my remote server port is open and can be accessed by anyone .
But still i am unable to connect to my remote unity game server hosted on AWS from my local windows machine ..
I am totally clueless what to do now .....pls give me solutions
Thank you everyone for answering i have found my answer.
The problem was that i have opened my TCP port on 55000 but did not opened my UDP port on 55000 in my AWS EC2 amazon linux server security group settings for inbound rules.
And ,if you are wondering how did i figure out that was the problem then, i used WIreshark to capture all my network data on my local winodws machine and i filtered the captued data using "ip.dst == " in the wirshark dashboard . ANd then i noticed that all the packets that was been sent to my remote server was been done on UDP and not in TCP on port 55000. So , i changed my aws security group settings to allow UDP inbound traffic on port 55000 and it solved the problem. My wireshark dashboard screenshot