DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Not all data gets through!!!!!!!!!!!

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Not all data gets through!!!!!!!!!!!

    [Originally posted by anon]

    I am making a game where there are two ships(two diff. players) connected over the internet, when one presses the up button, thier ship moves up and winsock1 sends a message to the other comp saying dat the first player's ship just moved up, my problem is that, when the person or both players move at the same time/a bunch of times, not all the commands or messages go through, so while one sees a blue ship in the top left corner, the other sees a blue ship approaching the top left corner. What do I do!!?!?!

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by Greg DeBacker]

    You could implement a command confirmation scheme of some sort. When you send a command you wait for a response that the other computer as received everything before continuing. Another way might be to use a terminating string of some sort. All commands end in the same string. The other computer would not send until they get the special terminating string to indicate that all commands have be received.

    Grex

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by Marty]

    I agree. I have a feeling that one computer is receiving MULTIPLE commands at a time, and you're not processing them all. Each command should be wrapped in something (like XML) or given a delimiter. When you read from a socket (depending on how you are doing that - I usually use the Microsoft Winsock Control in VB), make sure you use the Length parameter to read ALL the data. I usually add data to a module level string varriable (msBuffer = msBuffer & (data from socket), and then parse the buffer as it may have multiple and/or incomplete commands (data). When you process one piece of data, pull it off the buffer and grab the next one.

    Hope this helps,

    Marty

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by chusak]

    hi

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by anon]

    uh.... thanks guys, I am kind of a newb at VB, It's only been 2 years and i tought myself, so, if any1s got any websites or exmples, it would help.

    -And thanks

    -Peter

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by anon]

    uh.... thanks guys, I am kind of a newb at VB, It's only been 2 years and i tought myself, so, if any1s got any websites or exmples, it would help.

    -And thanks

    -Peter

  7. #7
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Not all data gets through!!!!!!!!!!!

    [Originally posted by chusak]

    i want

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center