Version: 1.1.1.0
Create multi-threaded servers and powerful Internet applications in .NET.

Udp .NET Component

Use the Udp component within the .NET Framework to send and receive user datagrams. Features include:

  • Simple, intuitive Listen, Send, and Receive methods handle all communication.
  • JoinMulticastGroup and LeaveMulticastGroup makes managing multicast communication easy.
  • Send UDP data synchronously or asynchronously.
  • Trace event exposes the underlying UDP communication.
  • Design-time editor assists in protocol testing.
  • C# and VB.NET sample projects with source.
  • Integrates with all versions of Visual Studio and supports C#, VB.NET, ASP.NET, Delphi 8, C# Builder, and other .NET compliant development environments.
  • Includes a royalty-free license!

Looking forĀ the ActiveX version of this component?

Interface

Public Constructors
Udp Overloaded. Initialize a new instance of the Udp class.
Public Properties
Active Returns true when listening for datagrams.
Available Gets the total number of bytes available.
BufferSize Gets and sets the size of the system receive buffer.
Busy Returns true if a method is currently in use.
Charset Gets and sets the character set used for string/byte array conversions.
DoEvents Gets or sets a value that controls the processing of events during blocking method calls.
Editor In Visual Studio.NET, displays an interactive form to use to test real time protocol operations.
LocalEndPoint Gets the IP interface and port currently in use.
MulticastInterface Gets or sets the host interface to use when sending multicast datagrams.
MulticastTimeToLive Gets and sets the IP multicast time-to-live used when datagrams are sent to multicast addresses.
Socket Returns the instance of the System.Net.Sockets.Socket that is accepting connections.
SynchronizingObject Set this object to automatically control thread marshalling between worker threads and the main UI thread.
Tag Gets or sets an object reference that can be used to associate this instance with any other.
Timeout Specifies the maximum number of milliseconds to wait for responses to commands or time between data buffer transfers.
Public Methods
BeginReceive Overloaded. Asynchronously receive a datagram, specifying a buffer, offset, size and SocketFlags value.
BeginSend Overloaded. Asynchronously send a datagram to the specified remote address and port, specifying a buffer, offset, size and SocketFlags value.
Close Close the socket.
JoinMulticastGroup Join the specified multicast group for receiving datagrams.
LeaveMulticastGroup Leave the specified multicast group for receiving datagrams.
Open Overloaded. Allocate a socket at the specified address and port for sending and receiving datagrams.
Receive Overloaded. Receive a datagram, specifying a buffer, offset, length and SocketFlags value.
Send Overloaded. Send a datagram to the specified remote address and port, specifying a buffer, offset, length and SocketFlags value.
Public Events
ActiveChanged Raised when the value of the Object.Active property changes.
EndReceive Raised when the Udp.BeginReceive request completes.
EndSend Raised when the Udp.BeginSend request completes.
Trace Raised when data has been sent/received.

Code Example

How easy is the Udp component to use? The following example demonstrates sending datagrams to a UDP echo server and receiving the response.

VB.NET Example
' Listen on the default interface and an ephemeral port.
Udp1.Open()

' Send a datagram to a echo server
Dim s as String = "test"

' Send the string s to the host "MyEchoServer" on port 7.
Udp1.Send(s, "MyEchoServer", 7)

' Receive the echoed data
Dim d as Datagram = Udp1.Receive(s.Length)

' Display the data.
Debug.WriteLine(d.ToString())

'* Output
'* ------------------------
'* test
'* ------------------------
'*