Results 1 to 4 of 4

Thread: [RESOLVED] winsock problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    5

    Resolved [RESOLVED] winsock problem

    hi,
    I have a server application that sends a number of strings to another via winsock.The client then seperates them depending on their identifier at the start of the string and places them to the apropriate textbox
    Heres the code:

    wschat.SendData ("u1" & Form1.username.Text)
    wschat.SendData ("ph" & php.Text)
    wschat.SendData ("tu" & k)

    The problem is that allstrings arrive together...
    For example their form is u1usernamephplayertu3
    instead of u1username then phplayer and lastly tu3
    Can you please help me?

  2. #2
    Addicted Member
    Join Date
    Apr 2003
    Posts
    148

    Re: winsock problem

    i think u send too fast
    wschat.SendData ("u1" & Form1.username.Text)
    doevents
    wschat.SendData ("ph" & php.Text)
    doevents
    wschat.SendData ("tu" & k)

    or u can put something end of the each packet so u can split them

  3. #3
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: winsock problem

    I remember having this problem when I was kinda new to Winsock.

    Separate each individual packet and split them up at the server, ie:

    Code:
    Socket.SendData "Packet 1" & vbCrlf
    Socket.SendData "Packet 2" & vbCrlf
    Then when they arrive you can use the Split() function to separate each packet.

    They would look like this:

    Packet 1
    Packet 2

    Of course you can use anything you want (not necessarily a vbCrLf) to separate the packets.

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    5

    Re: winsock problem

    thanks for your replies,it solved the problem

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