|
-
Nov 27th, 2002, 10:06 AM
#1
Thread Starter
Member
strings and sockets
i have a client server program
the client gets a username and then converts it to a unicode byte array with it then sends throguth a socket
at the server side it
converts the bite array back to a unicode string
then compares it with the structure of usernames, but it always failes
when looking at both strings in the watch window both apper identical, however when i check the lenght one is 5 one is 128.
i have tried trimming the string but i still cannot get rid of the extra stuff
how do i do it??
-
Nov 27th, 2002, 10:19 AM
#2
Frenzied Member
cast it to a string using .ToString() on the server when it recieves it..
that might work
-
Nov 27th, 2002, 10:26 AM
#3
Thread Starter
Member
i tried the tostring on the byte array, but when i view the string it says: "System.Byte[]"
-
Nov 27th, 2002, 10:40 AM
#4
Frenzied Member
did you do ToString() on the object type? or the actual string?
it seems like you did the type not the actual string
for example if i have a array of chars
i would do
string myString = "";
foreach(char ch in arrOfChars)
{
myString += ch.ToString(); //this will convert the char to string then append it to a string so u get literal values
}
try the samething iwth yoru byte array
then whe ur done.
compare myString with what ever u need to compare from the server to determine if the user name was correct
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|