I have an old vb6 desktop application which communicates with a mainframe server using socket (winsock 2) that i need to convert to .net. I found the small code which seems correct to me using System.Net.Socket. When running the console window just hang there showing blank.
So I run wireshark on the port the app is communicating (port in the code above) I can see package sent and received with connectSocket, but no package is detected with s.Send(bytesSent). I wonder why.
Code:
Dim s As Socket = ConnectSocket(server, port)
If s Is Nothing Then
Return "Connection failed"
End If
' Send request to the server.
Dim numSent As Integer
numSent = s.Send(bytesSent)
Dim bytes As Int32
Do
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0)
Console.WriteLine(bytes.ToString())
Loop While bytes > 0