Quantcast
Channel: Latest Questions by Chesley
Viewing all articles
Browse latest Browse all 62

NetworkStream Data Overpowering

0
0
hello there, my problem might be a bit complicated. i made my own server application using Java. i got 2 players, a chat, a server, and player state sync **heres my problem:** when i have 2 players, and Player 1 continuously sends chat messages (sends message to server. server sends to all players, including the player that send it) and the other player starts walking (continuously sends a new location to server. server sends location to other player) sometimes an incoming chat message, is NOT being read by the StreamReader, and instead it reads the location. now this little problem happens on pretty much every object, when 1 object moves, another freezes (if it was also moving). one thing overpowers the rest. **what I'm using:** The server basically receives data from the clients, and sends it back, using PrintWriter, to either only the other players, just the player, or all other players (depending on the data). then other players receive that using a StreamReader.ReadLine(); the data gets send over to the main thread, and the main thread handles the final things. now is there a way to, even when theres LOADS and LOADS of data coming in, still read EVERY line of data, instead of sometimes not reading a few lines **what i think is happening:** because the player loc sends continuously, the moment the Thread is reading the data, it leaves a little space. when other data comes in on exactly the moment its reading data. the data will not be read thank you in advance

Viewing all articles
Browse latest Browse all 62

Latest Images

Trending Articles





Latest Images