Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15722

VS 2019 Socket connected but send doesn't seem to work

$
0
0
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.
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

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.

Viewing all articles
Browse latest Browse all 15722

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>