B
Borgbjerg
I've got a multi-threaded server (we are very early in the project,
trying to uncover some risks), and I want to send data using XML.
The class ServerAdapter is supposed to connect to the server (which
works fine), to send data, but on the same stream be able to read
data (which is causing problems).
In the function "bool Connect()", we want to instantiate the
XmlTextReader with the stream that we got from the 'TcpClient
client', but somehow that goes wrong. No exception is cast, but the
problem definately has something to do with the stream that we get
from the call 'client.GetStream()'.
When we try to do the exact same thing, with a stream NOT from a
TcpClient, there is no problem. We've checked to see if it had
something to do with the access-property on the connection (the
'Socket') on the serverside, but it came up negative. I am pretty
much out of ideas, so if you can help me out, it'd be great (first
time here, so I dont know the standarts)
We've checked how far it gets with text-outputs, so we KNOW that the
XmlTextReader causes the problem.
Here is the part of code that fails.
public class ServerAdapter : IServerAdapter
{
private IServerEventHandler serverEventHandler;
private TcpClient client;
private NetworkStream stream;
private Thread readThread;
private XmlTextReader streamReader;
private XmlTextWriter streamWriter;
private BinaryReader reader;
private XmlValidatingReader validatingReader;
private XmlSchemaCollection schemaCollection;
public ServerAdapter()
{
}
public ServerAdapter( IServerEventHandler serverEventHandler ):base()
{
this.serverEventHandler = serverEventHandler;
}
public bool Connect()
{
bool connected = false;
try
{
client = new TcpClient();
client.Connect( "10.0.55.12", 4312 );
stream = client.GetStream();
streamReader = new XmlTextReader( stream );
streamWriter = new XmlTextWriter( stream, new
System.Text.UTF8Encoding() );
blablabla....
Thanks in advance
...Borgbjerg
trying to uncover some risks), and I want to send data using XML.
The class ServerAdapter is supposed to connect to the server (which
works fine), to send data, but on the same stream be able to read
data (which is causing problems).
In the function "bool Connect()", we want to instantiate the
XmlTextReader with the stream that we got from the 'TcpClient
client', but somehow that goes wrong. No exception is cast, but the
problem definately has something to do with the stream that we get
from the call 'client.GetStream()'.
When we try to do the exact same thing, with a stream NOT from a
TcpClient, there is no problem. We've checked to see if it had
something to do with the access-property on the connection (the
'Socket') on the serverside, but it came up negative. I am pretty
much out of ideas, so if you can help me out, it'd be great (first
time here, so I dont know the standarts)

We've checked how far it gets with text-outputs, so we KNOW that the
XmlTextReader causes the problem.
Here is the part of code that fails.
public class ServerAdapter : IServerAdapter
{
private IServerEventHandler serverEventHandler;
private TcpClient client;
private NetworkStream stream;
private Thread readThread;
private XmlTextReader streamReader;
private XmlTextWriter streamWriter;
private BinaryReader reader;
private XmlValidatingReader validatingReader;
private XmlSchemaCollection schemaCollection;
public ServerAdapter()
{
}
public ServerAdapter( IServerEventHandler serverEventHandler ):base()
{
this.serverEventHandler = serverEventHandler;
}
public bool Connect()
{
bool connected = false;
try
{
client = new TcpClient();
client.Connect( "10.0.55.12", 4312 );
stream = client.GetStream();
streamReader = new XmlTextReader( stream );
streamWriter = new XmlTextWriter( stream, new
System.Text.UTF8Encoding() );
blablabla....
Thanks in advance
...Borgbjerg