DreamDancer

Winsock::MessagePump

Mar 14th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' this is also treated like a message proc, it's registered in it's own windowclass as well
  2. Public Function MessageProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  3. ' variable declares not shown, this is an example of the code action
  4.  
  5.         If ServerToClientTop <> ServerToClientBottom Then
  6.           Do Until ServerToClientBottom = ServerToClientTop
  7.             SendData socketClient, ServerToClientBuffer(ServerToClientBottom)
  8.             ServerToClientBuffer(ServerToClientBottom) = ""
  9.             ServerToClientBottom = ServerToClientBottom + 1
  10.             If ServerToClientBottom > SERVERMAX Then ServerToClientBottom = 0
  11.           Loop
  12.         End If
  13.  
  14.         If ClientToServerTop <> ClientToServerBottom Then
  15.           Do Until ClientToServerBottom = ClientToServerTop
  16.             SendData socketServer, ClientToServerBuffer(ClientToServerBottom)
  17.             ClientToServerBuffer(ClientToServerBottom) = ""
  18.             ClientToServerBottom = ClientToServerBottom + 1
  19.             If ClientToServerBottom > CLIENTMAX Then ClientToServerBottom = 0
  20.           Loop
  21.         End If
  22.  
  23. ' note that unless we're processing one of our messages, you MUST call DefWindowProc
  24. MessageProc = DefWindowProc(hwnd, uMsg, wParam, lParam)
  25.  
  26. End Function
  27. ' this is an example of how to interrupt the connection, if you need to process messages
  28. ' maintain proper data flow between the server and the client
Advertisement
Add Comment
Please, Sign In to add comment