0

Hello sorry for asking but I've tried looking everywhere and I can't get this working. I can send packets to my local IP address just fine but not to my online IP address. I've tried microsofts winsock example code and even that is not working.

My port is open and if I use an "open port check tool" on google my server will say "connection closing." The port check tool also only says my port is open if my server is running. Can someone please help me or point me to a working server/client example?

My code tags wouldn't format properly here so I had to put my code on github. I made some changes to the code so I don't have to pass it command line arguments. I would really appreciate some help I have look everywhere but I can't get it working.

https://github.com/charmanderstrom/winsock

andrew
  • 1
  • 1
    Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take [the SO tour](http://stackoverflow.com/tour), read about [how to ask good questions](http://stackoverflow.com/help/how-to-ask), as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). You might also be interested in [reading the editing help](https://stackoverflow.com/editing-help). Lastly please learn how to create a [mcve]. – Some programmer dude Mar 01 '19 at 10:03
  • Regarding your problem, have you checked what interface (IP address) your server binds to? Perhaps you should bind to the wild-card address to allow connections from all interfaces? And are all firewalls and routers between the two systems allowing the connection? Finally, do the client connect to the correct address? It's not a hard-coded address that's only valid locally (like the "**local**host" address `127.0.0.1`)? – Some programmer dude Mar 01 '19 at 10:06
  • You are conntecting to the localhost - `"127.0.0.1"` by your client app. Use your server IP address or DNS name. – Victor Gubin Mar 01 '19 at 10:10
  • Thanks for the replies. I don't know how to check what interface my server binds to. Can you please tell me how to bind to the wild card address? And my firewall and router firewall is turned off. If I use 127.0.0.1 it works but if I change that to my real IP then it doesnt work. – andrew Mar 01 '19 at 10:37
  • @andrew use the command line netstat tool on the server machine. To use the wildcard address, bind to 0.0.0.0 – Remy Lebeau Mar 02 '19 at 19:12

0 Answers0