i have a username and password login box when i send data to the socket its fine but when i print the same data from socket then extra bit is added a head of username. why is it so...please suggest
47pirates
9
Junior Poster in Training
Recommended Answers
Jump to Postthis is very little information to go on .. can you elaborate on the matter?
Jump to PostWhat do you mean by "bit"? In computer terminology a bit is 1/8 part of a byte.
It is hard to add a bit to a String. You can only work with bytes (8 bits).
Jump to PostCan you add some printlns to the code to show what is happening?
Print out the first two letters of the String that has the extra characters using the Integer toHexString method with the charAt(0) & charAt(1) of the String.
That will show what the 2 chars are.
Jump to PostAre you certain that you are using matching streams and encoding for the read and the write? Is the user name the very first thing sent over the socket?
All 15 Replies
stultuske
1,116
Posting Maven
Featured Poster
NormR1
563
Posting Sage
Team Colleague
stultuske
commented:
good point
+14
47pirates
9
Junior Poster in Training
NormR1
563
Posting Sage
Team Colleague
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
NormR1
563
Posting Sage
Team Colleague
47pirates
9
Junior Poster in Training
NormR1
563
Posting Sage
Team Colleague
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
DavidKroukamp
105
Master Poster
Team Colleague
Featured Poster
NormR1
563
Posting Sage
Team Colleague
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.