I recently jumped in to Network programming and i've some consol chatting programs. All of the tutorials out there are either Server to Client or peer to peer connection. I want to do a Host and it's just a server with a player on the same machine. So i'm using asynchronization method on both the host/server and client. But I can only detect if a client connects but i can't send data or recieve from it. I think the problem is that because it's non-blocking accept doesn't give me a valid socket when accept is called.
code:
LRESULT CALLBACK MainProcedure(HWND hWnd, UINT Message,WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_ONSOCKET:
{
switch (WSAGETSELECTEVENT(lParam))
{
case FD_WRITE:
break;
case FD_READ:
WBOX(L"Package recieved");
break;
case FD_CONNECT:
break;
case FD_ACCEPT:
break;
case FD_CLOSE:
I recently jumped in to Network programming and i've some consol chatting programs. All of the tutorials out there are either Server to Client or peer to peer connection. I want to do a Host and it's just a server with a player on the same machine. So i'm using asynchronization method on both the host/server and client. But I can only detect if a client connects but i can't send data or recieve from it. I think the problem is that because it's non-blocking accept doesn't give me a valid socket when accept is called.
code:
LRESULT CALLBACK MainProcedure(HWND hWnd, UINT Message,WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_ONSOCKET:
{
switch (WSAGETSELECTEVENT(lParam))
{
case FD_WRITE:
break;
case FD_READ:
WBOX(L"Package recieved");
break;
case FD_CONNECT:
break;
case FD_ACCEPT:
break;
case FD_CLOSE: