Sign in to follow this  

C++ Networking

This topic is 3850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i was looking at the gpwiki SDL networking tutorial. (http://gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net) i was just wonder how the client resolved the ip and the port of the server?

Share this post


Link to post
Share on other sites
Normally the host port and ip are known to a client unless there is a game lobby, but even then the lobby is known. From a quick look :
Quote:


/* Resolve the host we are connecting to */
if (SDLNet_ResolveHost(&ip, argv[1], atoi(argv[2])) < 0)

The client is getting the information from the command line.

Share this post


Link to post
Share on other sites
so in a game lobby i would have the client connect to my websites server

then that brings up two questions. how do i find out the ip address of the computer the program is running on. and how would i program my linux server to open the lobby socket? im experienced with PHP, and i know how to use sockets with it, but how would i keep it connected to the socket 24/7?

Share this post


Link to post
Share on other sites
I think your questions would be better being posted in the network forum, but anyway.
Quote:

how do i find out the ip address of the computer the program is running on.
Do you mean the server? for server it would be an hard coded port and possibly a web addy.
Quote:

how would i program my linux server to open the lobby socket

Just using BSD and connecting to.
Quote:
... but how would i keep it connected to the socket 24/7
which do you mean the server or client?

Share this post


Link to post
Share on other sites
i dont think my hosting company would appreciate my socket program running 24/7, its a shared server after all. but i thought up an idea to have (almost) serverless lobby. i only have one question, is there any way to read and write to a database on my server using C++?

Share this post


Link to post
Share on other sites

This topic is 3850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this