I'm having a tough time getting System.Net.Sockets to work with a server
that's based around Winsock 6.0. For many reasons I can't write a new server
because the server handles a number of client formats.
I'm writing a new client that should be able to connect to the Winsock-based
server. However, I can't get them to talk to each other. The server hears
and understands what System.Net.Sockets is saying, but when it tries to
respond System.Net.Sockets just acknowledges the connection.
Whatever I do (tcpClient, Socket, bufferbased or streambased) the app that
uses the socket-class just reports that the connection is just a mere
connection but that there is no data availible.
----
Dim tcpListen as New TcpListener(13301)
Dim client As Socket
----
Private Sub PollTimer_Elapsed(ByVal sender As System.Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles PollTimer.Elapsed
Dim datBytes() As Byte
Dim datStr As String
Dim numBytes As Integer
Try
If tcpListen.Pending = True Then
client = tcpListen.AcceptSocket
If client.Poll(1, SelectMode.SelectRead) = True Then
numBytes = client.Available
client.Receive(datBytes)
End If
End If
client.Close()
Catch exc As Exception
Console.WriteLine(exc.Message)
Console.WriteLine(exc.StackTrace)
Console.WriteLine(exc.TargetSite)
Console.WriteLine(exc.GetType)
End Try
End Sub
---
Has anyone been into this before? Any links, pointers to articles or
tutorials?