This project has moved. For the latest updates, please go here.

Any sample code for vb.net

Jun 4, 2010 at 6:03 AM
Edited Jun 4, 2010 at 6:19 AM

Hi,

The example provided for both the client and server example is really great.

However I need the code in vb.net.
So tried to make use of the C# to vb converter to convert the code but end up with errors.

The error for the server example is inside the

Private Sub ChildSocket_WriteCompleted(ByVal socket As SimpleServerChildTcpSocket, ByVal e As AsyncCompletedEventArgs)
...
End Sub    

Sub ListeningSocket_ConnectionArrived(ByVal e As AsyncResultEventArgs(Of SimpleServerChildTcpSocket))

....
Dim socket As SimpleServerChildTcpSocket = e.Result
ChildSockets.Add(socket, ChildSocketState.Connected)
AddHandler socket.PacketArrived, AddressOf ChildSocket_PacketArrived
AddHandler socket.WriteCompleted, AddressOf ChildSocket_WriteCompleted
AddHandler socket.ShutdownCompleted, AddressOf ChildSocket_ShutdownCompleted

The error generated is for the last three line is something like

Error    2    Method 'Private Sub ChildSocket_WriteCompleted(socket As Nito.Async.Sockets.SimpleServerChildTcpSocket, e As System.ComponentModel.AsyncCompletedEventArgs)' does not have a signature compatible with delegate 'Delegate Sub Action(Of System.ComponentModel.AsyncCompletedEventArgs)(obj As System.ComponentModel.AsyncCompletedEventArgs)'.  



Is there any experts around here who can show me how to rectify the error or better still if there can be an example in vb.net.

If there is a need, I can email the entire converted code with error.

Thanks