The MAKEWORD(2,2) parameter of WSAStartup makes a request for version 2.2 of Winsock on the system, and sets the passed version as the highest version of Windows Sockets support that the caller can use. messages, the server wouldnt process incoming messages anymore. UDP client sends 21 messages per second with 7126 bytes in total. The client and server application that is used for illustration is a very basic client and server. It is designed to provide an understanding of basic Winsock functions and data structures, and how they work together. very simple: receive data, parse it and display it on text boxes. The following is a step-by-step guide to getting started with Windows Sockets programming. The WSADATA structure contains information about the Windows Sockets implementation. Hi, I have a simple UDP server running on 162 snmp port. The WSAStartup function is called to initiate use of WS2_32.dll. Printf("WSAStartup failed: %d\n", iResult) Notice that the sender is getting, the data and its passing s as a ByRef variable. I think winsock should prevent me from doing the below in a 2nd running instance of my uDP server application, but maybe Im forgetting something. IResult = WSAStartup(MAKEWORD(2,2), &wsaData) Private Sub DataArrival( ByVal sender As WinsockControl.Winsock, ByVal BytesTotal As Integer) Handles Winsock3.DataArrival Dim s As String sender.GetData(s). From the server form you can start pre-defined. On project start, an instance of the component listens on port 22222 (can be changed in code). Server would echo a client request prefixed by 'you sent ' (echo server). Example demonstrates using the component in client-server scenario. WSADATA wsaData Ĭall WSAStartup and return its value as an integer and check for errors. VB6 CLient-Server example for OstroSoft Winsock Component. Just make sure you add a Sub called yourwinsocknameDataArrival. This also makes certain that Winsock is supported on the system.Ĭreate a WSADATA object called wsaData. VB6 and networking (UDP) Hello If you are using the vb winsock control you probaly have something like: winsock.Close. All processes (applications or DLLs) that call Winsock functions must initialize the use of the Windows Sockets DLL before making other Winsock functions calls.