Who ever deleted that full code post... Thank you!.
---------------------------------------------------------------
ok i did what you said:
protected
override void LoadContent()
{
spriteBatch =
new SpriteBatch(GraphicsDevice);
font = Content.Load<
SpriteFont>("Font");
TcpClient tcpClient = (TcpClient)client;
NetworkStream clientStream = tcpClient.GetStream();
byte[ message = new byte[4096];
int bytesRead;
while (true)
{
bytesRead = 0;
try
{
//blocks until a client sends a message
bytesRead = clientStream.Read(message, 0, 4096);
}
catch
{
//a socket error has occured
break;
}
if (bytesRead == 0)
{
//the client has disconnected from the server
break;
}
//message has successfully been received
ASCIIEncoding encoder =
new ASCIIEncoding();
System.Diagnostics.
Debug.WriteLine(
encoder.GetString(message, 0, bytesRead));
}
tcpClient.Close();
}
That was the code on the page, accept from the void loadcontent.
I get three errors. I tryed putting bool methods in but doesnt work.
| Errors | -
Error 1 The type or namespace name 'TcpClient' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The type or namespace name 'TcpClient' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The name 'client' does not exist in the current context
Error 4 The type or namespace name 'NetworkStream' could not be found (are you missing a using directive or an assembly reference?)
Error 5 The type or namespace name 'ASCIIEncoding' could not be found (are you missing a using directive or an assembly reference?)
Error 6 The type or namespace name 'ASCIIEncoding' could not be found (are you missing a using directive or an assembly reference?)