System.Net.Sockets and the Winsock 6?

MicroMan

New member
Joined
Dec 20, 2003
Messages
3
Im having a tough time getting System.Net.Sockets to work with a server thats based around Winsock 6.0. For many reasons I cant write a new server because the server handles a number of client formats.

Im writing a new client that should be able to connect to the Winsock-based server. However, I cant 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) the socket-class just reports that it is a mere connection but no data availible.

Has anyone been into this before? Any links, pointers to articles or tutorials?

----

This is the routine that listens for connections. Sending data from the .Net application to the Winsock 6 based server works well, but sending data from the Winsock 6 server to the .Net application doesnt.

The VB.Net app senses the connection attempt, but never senses the data behind it. Anyone?

Code:
Private Sub PollTimer_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles PollTimer.Elapsed 
    Static started As Boolean 
    Dim ns As NetworkStream 
    Dim data() As Byte, dte As Byte 

    If Not (tcpListen Is Nothing) Then 

      SOCKET W/O Networkstream 
      If tcpListen.Pending = True Then 
       Console.WriteLine("Pending...") 
       Client = tcpListen.AcceptSocket 
       Console.Write(Client.Available) 
       ReDim Preserve data(data.GetUpperBound(0) + Client.Available) 
       Client.Receive(data, Client.Available, SocketFlags.None) 
       Console.Write(data.GetUpperBound(0)) 
      End If 
      Client.Close() 

      TcpClient() 
      If tcpListen.Pending = True Then 
       Client = tcpListen.AcceptTcpClient 
       ns = Client.GetStream 
       If ns.DataAvailable = True Then 
       While ns.DataAvailable 
       ReDim Preserve data(data.GetUpperBound(0) + 1) 
       data(data.GetUpperBound(0)) = ns.ReadByte 
       Application.DoEvents() 
       Console.WriteLine(data.GetUpperBound(0)) 
       End While 
       End If 
      End If 

    Else 
      tcpListen.Start() 
      started = True 
    End If 
  End Sub
 
Back
Top