kennedy chozo

kennedy chozo

  • NA
  • 7
  • 33k

C# ReadSocket Function

Nov 13 2013 2:40 AM
Hello, I just want to know how every single line of code actually does.

Codes :

1    private String SocketRead(Socket socket)   {
2       StringBuilder result = new StringBuilder();   
3        byte []buffer = new byte[1];     
4         while( socket.Receive(buffer)>0 )    {    
5                char ch = (char)buffer[0];    
6                if( ch=='\n')      break;
7                if( ch!='\r')      result.Append(ch);   
8        }
9    return result.ToString();
10  }

I don't understand line 3,4 and 5. What does byte[1] means ?



Answers (3)