Toolbox.NETMF.NET.IntegratedSocket

This class uses the SimpleSocket interface to access the .NETMF integrated IP stack.

Toolbox.NETMF.NET.IntegratedSocket(Hostname, Port)
  • Hostname The remote hostname
  • Port The remote TCP port

Methods

See the interface SimpleSocket for a full list of methods

Sample code in C#

// Defines the socket, including the remote host and port
SimpleSocket Socket = new IntegratedSocket("www.netmftoolbox.com", 80);

// Connects to the socket
Socket.Connect();

// Does a plain HTTP request
Socket.Send("GET /helloworld/ HTTP/1.1\r\n");
Socket.Send("Host: " + Socket.Hostname + "\r\n");
Socket.Send("Connection: Close\r\n");
Socket.Send("\r\n");

// Prints all received data to the debug window, until the connection is terminated
while (Socket.IsConnected)
{
    Debug.Print(Socket.Receive());
}

// Closes down the socket
Socket.Close();

Sample code in VB

' Defines the socket, including the remote host and port
Dim Socket As SimpleSocket = New IntegratedSocket("www.netmftoolbox.com", 80)

' Connects to the socket
Socket.Connect()

' Does a plain HTTP request
Socket.Send("GET /helloworld/ HTTP/1.1" + Constants.vbCrLf)
Socket.Send("Host: " + Socket.Hostname + Constants.vbCrLf)
Socket.Send("Connection: Close" + Constants.vbCrLf)
Socket.Send(Constants.vbCrLf)

' Prints all received data to the debug window, until the connection is terminated
Do While Socket.IsConnected
    Debug.Print(Socket.Receive())
Loop

' Closes down the socket
Socket.Close()

Last edited May 31, 2012 at 2:29 PM by Garrcomm, version 3