Ok I found the problem I think. My method of accepting users was fine, but my use of the mutex wasn't. Here it is;p
declaration
HANDLE g_hCreditMutex;
while( 1 )
{
ServerSocketObject.Listen();
WaitForSingleObject( g_hCreditMutex, INFINITE );
clients += 1;
ServerSocketObject.Accept(...
Um I know its a simple thing seeing how every single game and program on the internet has to do it so someone would have by now figured out a simple and effecient way to do it. Just because its simple doesn't mean I am obliged to instantly know how to do it. In theory my way would work, but...
I was just following this example in this book for learning how to game programming. I don't have any background in online programming. But I have a background in C++ programmming and computer science. I've taking 2 computer programming C++ and 2 years of AP Computer Science. I also program in a...
Also here is some more information. SocketObject is just a prewritten class I'm using to learn this stuff with It is just the predefined windows SOCKET class with some variability.
Here is the code for the functions I use:
-----
int SocketObject::Listen( void )
{
return listen( skSocket, 32...
Well.. since you obviously see what I'm trying to do.. you got a way for me to do it? ;X Cause this way doesn't seem to work to well. The data isn't being sent to the server. I think... o.o
if( ClientSObject.Connect( szServerIP, iServerListenPort ) )
{
while (true)
{
while ( !_kbhit() )...
Well I took your advice and it seems still no one=p
I got a new question tho. Does this code even if its in a thread make the program wait for connections and NOT do anything else even when in a thread?
void thrClientsThread( SocketObject *sm )
{
// Loop until we are told to quit
while( 1 )...
Um debugger just goes "eee find the .cpp file!" so there's no help there. Plus this is a server/client program so like yeah I dun think debugger can work on something like that. Section of code I guess that is "relevant":
void thrClientsThread( SocketObject *sm )
{
//...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.