SDL and Winsock - Flashing images?

  • (8 Pages)
  • +
  • « First
  • 6
  • 7
  • 8

113 Replies - 3020 Views - Last Post: 04 July 2013 - 11:15 PM Rate Topic: -----

#106 fysez  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 14-June 13

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 07:52 PM

View PostSkydiver, on 03 July 2013 - 03:51 PM, said:

Okay, can you show us your client side code that tries to detect the IP address of the server? If you can't detect the IP address of the server, you have have no choice but to try to ask the user to enter the IP address.


ser.sin_family=AF_INET;
    ser.sin_port=htons(2359);
    ser.sin_addr.s_addr=inet_addr("IPv4 ADDRESS HERE");
    memcpy(&addr,&ser,sizeof(SOCKADDR_IN));
    
    res = WSAStartup(MAKEWORD(1,1),&data);
 
    if(res != 0) {
        gamerunning = false;
    }

    sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);

    if(sock==INVALID_SOCKET ) {
            gamerunning = false;
    } else if(sock==SOCKET_ERROR) {
            gamerunning = false;
    }

    res=connect(sock,&addr,sizeof(addr));
    if(res !=0 ) {
            gamerunning = false;
    } else {
            memcpy(&ser,&addr,sizeof(SOCKADDR));
    }
    ...

Was This Post Helpful? 0
  • +
  • -

#107 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 08:08 PM

So the IP address on line 3 is hardcoded? Is it hard coded to be your WAN side IP, or is your LAN side 192.168.x.y address?

To find out what your WAN side IP address is, you can either dig around on the status pages of your router, or you could go to whatsmyip.org.
Was This Post Helpful? 1
  • +
  • -

#108 fysez  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 14-June 13

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 08:23 PM

View PostSkydiver, on 03 July 2013 - 08:08 PM, said:

So the IP address on line 3 is hardcoded? Is it hard coded to be your WAN side IP, or is your LAN side 192.168.x.y address?

To find out what your WAN side IP address is, you can either dig around on the status pages of your router, or you could go to whatsmyip.org.


I changed my line 3 to connect to the address found in "whatsmyip.org" and it just stops my program from running. The server runs, But when the client tries to connect... nothing.
The client begins the whole "Not Responding" thing windows like to do.
Was This Post Helpful? 0
  • +
  • -

#109 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 08:51 PM

If you set a breakpoint on the client, where is it hanging? I- it hanging on the connect() or recv() call?
Was This Post Helpful? 1
  • +
  • -

#110 fysez  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 14-June 13

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 09:20 PM

View PostSkydiver, on 03 July 2013 - 08:51 PM, said:

If you set a breakpoint on the client, where is it hanging? I- it hanging on the connect() or recv() call?


connect() call
Was This Post Helpful? 0
  • +
  • -

#111 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: SDL and Winsock - Flashing images?

Posted 03 July 2013 - 10:29 PM

Are you sure that you correctly setup your port forwarding so that incoming connections to your router will be forwarded to your machine which is running the server? I recall you saying that the IP address of your machine that is running the server changes all the time. Most of the consumer grade routers I know about only let you do port forwarding to a specific IP address instead of a specific MAC address.

Another thing to consider is using port triggering instead of port forwarding, but this will require even more networking code on your server. As it is now, it's already a struggle to help you figure out your networking issues.
Was This Post Helpful? 1
  • +
  • -

#112 fysez  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 14-June 13

Re: SDL and Winsock - Flashing images?

Posted 04 July 2013 - 09:27 AM

View PostSkydiver, on 03 July 2013 - 10:29 PM, said:

Are you sure that you correctly setup your port forwarding so that incoming connections to your router will be forwarded to your machine which is running the server? I recall you saying that the IP address of your machine that is running the server changes all the time. Most of the consumer grade routers I know about only let you do port forwarding to a specific IP address instead of a specific MAC address.

Another thing to consider is using port triggering instead of port forwarding, but this will require even more networking code on your server. As it is now, it's already a struggle to help you figure out your networking issues.


I went into my router and did the "Port Forwarding."
I set it up, and made the port the same as the port in my code (2359).
Was This Post Helpful? 0
  • +
  • -

#113 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: SDL and Winsock - Flashing images?

Posted 04 July 2013 - 01:58 PM

Can you connect to your server's port 2359 using telnet from your client computer?

Yes, telnet will send junk data to your server, but at least you'll be able to verify that the server is getting data, and that a connection can be established from the client computer to the server running on the server's computer.

This thread has devolved to networking troubleshooting and is far astray from C/C++. I highly recommend starting a new thread in the networking subforum and getting help there.
Was This Post Helpful? 1
  • +
  • -

#114 fysez  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 14-June 13

Re: SDL and Winsock - Flashing images?

Posted 04 July 2013 - 11:15 PM

Okay I made a new topic on the Networking forum.
If you want to view it, great. If not, That's fine too.

But I do believe I made a better explination of what I've tried, have done, and my plan.
So in case you want to view it,
You can visit here.
Was This Post Helpful? 0
  • +
  • -

  • (8 Pages)
  • +
  • « First
  • 6
  • 7
  • 8