A litle problm with message sent

A

Alakhim Mohamad

I now have a client and a server accepted connection

Here is the code that server accept message from client after connect

try{
TcpClient client=new Tcpclient(add,port);
bytes[] by=new bytes[256];
Networkstream s=client.GetStream();
int b=s.read(by,0,by.length);

String msg=Encoding.Ascii.getstring(by,0,b);
console.writeline("{0}",msg);
client.close();
}

catch(exceptoin){something}


And from client
TcpClient client=new TcpClient(add,port);
if(connected){
string s="*~HAPPY* CHRISTMAS *_*EVERYONE*~ !!*!*!!*";
Networkstream stream=client.getstream();
Byte[] data=Encoding.Ascii.getbytes(s);

stream.write(data,0,data.length)
console.write("{0}",s)
}


There is no message set from client on Server edit box
Please fix it please, very urgent need
 
J

Jon Skeet [C# MVP]

Alakhim Mohamad said:
I now have a client and a server accepted connection

Here is the code that server accept message from client after connect

<snip>

Those certainly *aren't* the real bits of code, as they wouldn't
compile due to case problems. It would be much better to see the *real*
code.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top