simple networking

Started by
13 comments, last by crazy_andy 19 years, 4 months ago
sense you are using the accept function i'm assuming your making a server... so it's time for you to learn how to use multithreading.. that's probably the best way to do it.

As for your answer, it waits on the accept function until someone tries to connect.

I found these two great tutorials, which taught me everything i needed to know:
This one
and this one

Sorry if that's not exactly what your looking for, still a little too tired to be doing this this early [grin]

Hope that helps
~zix~


Edit: I was looking at those tutorials again, and i noticed i used _beginthread(function, NULL); instead of AFXBeginThread(), just so you know. Have to include process.h if you use my way though.

Edit2: I use a console, but it can be a win32 application... and i use commands both listen and accept, as you can probably see by the tutorials.
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
Advertisement
Thanks alot, I will look through those tuts now, and with any luck, I will be able to get it working.
www.stickskate.com -> check it out, some gnarly stick skating movies
OK, Ive made a server, following the tut, and it seems to work, however when its running, Im getting a connection from 204.204.204.204 constantly. Im using a wireless router, which it could be, but Im not sure. If it is then what can I do about it?
www.stickskate.com -> check it out, some gnarly stick skating movies
I was looking around and found this thread, and he had the same problem you did.
Thread here Google is very useful you know.

If you are having the same problem he was, it's simply a problem with the accept..
Quote:
Thanks. It was a problem @ accept(); I had to put the last param.

ret = sizeof(struct sockaddr);
sckClient = accept(sckListen,(LPSOCKADDR)&clientN,&ret);


Hope i could be of help
~zix~
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
cheers, it works great, Im not sure why since my original code was very similar, but thanks alot. consider yourself rated.
www.stickskate.com -> check it out, some gnarly stick skating movies

This topic is closed to new replies.

Advertisement