CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Winsock problem

  1. #1
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Winsock problem

    I have this code that gets data from a winsock element using TCP/IP and prints it to the debug windows, but something strange is going on.

    private sub Winsock_dataArrival(bytesReceived as long)

    dim strData as string
    Winsock.GetData strData
    debug.print strData

    End sub



    When I use another program and send data to that port, the data received looks funny, the first few characters are question marks. It's not a constant number of ?'s, sometimes there are 3, another time there are 7, it's always different.
    eg. I send 'subject: this is a test' it arrives as '????ect: this is a test' or as '???????: this is a test'
    I am using port 600 to do this, and the connection appears to be made correctly.

    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Winsock problem

    Try specifying the Type of Data you expect to recieve and how many Bytes you want, ie.

    Winsock.GetData strData, vbString, bytesReceived

    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured