This content has been marked as final. Show 9 replies
Just thought I'd add a point that I also just tried it with normal text so basically any text i send it adds the funky characters before it for some reason ?
Don't concatenate your control bytes into the String or they will be turned into Unicode. Send them separately.
Thanks, well even if I send ("Hi"); it will still recieve it with unicode before it.. and what i've noticed now is that it only does it for the first set of data it recieves.. after which it recieves the rest normally.
You must be writing chars and reading bytes then? or doing something else asymmetric?
Hi,The io schemes for the two endpoints of a socket communications should be properly paired and their data used should be mutually compatible.
I am having a problem sending the following string
over a stream from server to client.
which when written or sent or recieved should be
strUserName = "QTQ"; param = "hi"; Send the following: (""+CHAT2ALL+strUserName+(char)(220)+param);
But when i send it the client recieves it as : "��
104Q�hi", which is incorrect and corrupt in a
in a way, before the 104 where there is a 2 space gap
2 characters like a square appear.. which for some
reason can't get pasted.
Reader and Writer
DataInputStream and DataOutputStream ... methods used should be also properly paired
ObjectInputStream and ObjectOutputStream
byte and byte
string and string
Object and Object
I think your current code does violate these simple rules.
Hey, thanks both of you, I've managed to do it.. was a little minor silly mistake as pointed different readers and writers on both sides.... :)... just a quick question not sure if you'll don't want to open up a new topic already opened up many...
If lets say on the client I have a DataInputStream that reads from teh DataouputStream on the Server side in a loop wiating for messages... Now if Lets say I send some data using the ObjectStream from the server to the client will the DataInputStream read that data or will it stay in the stream waiting for an object stream to pick it up..
Also if it waits does that mean all other messages are stuck until that is read?
Okay fixed that tooo.. thanks guys :)
Just for the record:
If lets say on the client I have a DataInputStreamNo, it means that the input stream will misunderstand the output stream, as per the OP's original problem.
that reads from teh DataouputStream on the Server
side in a loop wiating for messages... Now if Lets
say I send some data using the ObjectStream from the
server to the client will the DataInputStream read
that data or will it stay in the stream waiting for
an object stream to pick it up..
Also if it waits does that mean all other messages
are stuck until that is read?
hehe, yeah thats what happened when i tried :(.. but it's okay i manage to implement what I had to another way..
Thanks again for your help