Categories
Computers Windows

SimpleSocket

SimpleSocket is a COM DLL server that wraps basic UDP send/receive functionality. It is quite simple to use from all major Windows programming environments (C++, C#, VB, VBScript etc).

This application is provided as-is and is free for any use provided that it is not resold or included in any commercial offering.

The DLL must be registered prior to use. Although this can be done in many ways, one simple way is:

  1. Extract the File SimpleSocket.dll to a suitable folder
  2. Press the start button and select “Run…”
  3. Type cmd and press OK
  4. Type regsvr32 followed by the full path to the DLL

Although the exact usage varies depending on programming environment, the following sample should be able to serve as a guide. It includes a sending and a receiving application. Put each of these code segments in a file with the suffix .vbs, then run them both.

Receiver

Set socket=WScript.CreateObject("SimpleSocket.Udp", "event_")
Sub event_OnReceive(data)
    WScript.Echo "Received: " & data
End Sub

socket.Listen "127.0.0.1", 10000
While(True)
    WScript.Sleep(5000)
Wend
socket.Abort

Sender

Set socket=WScript.CreateObject("SimpleSocket.Udp")
socket.Send "127.0.0.1", 10000, "Data sent from the client"

Methods

The following methods are supported

  • Listen {ip}, {port} – Starts listening for incoming data on the ip and port.
  • Abort – Stops listening for data.
  • Send {ip}, {port}, {data} – Sends the data to the peer using the ip and port. The data must be provided in text format.
  • OnReceive – Callback method for asynchronous notification of incoming data.

Uninstallation

  1. Press the start button and select “Run…”
  2. Type cmd and press OK
  3. Type regsvr32 -u followed by the full path to the DLL

Attachments

css.php