Results 1 to 2 of 2

Thread: message sent

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    1

    Question message sent

    I now have a client and a server accepted connection

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


    Code:
    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
    Code:
    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


    thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: message sent

    Moved from the CodeBank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width