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.GetStre am()'.
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 IServerEventHan dler serverEventHand ler;
private TcpClient client;
private NetworkStream stream;
private Thread readThread;
private XmlTextReader streamReader;
private XmlTextWriter streamWriter;
private BinaryReader reader;
private XmlValidatingRe ader validatingReade r;
private XmlSchemaCollec tion schemaCollectio n;
public ServerAdapter()
{
}
public ServerAdapter( IServerEventHan dler serverEventHand ler ):base()
{
this.serverEven tHandler = serverEventHand ler;
}
public bool Connect()
{
bool connected = false;
try
{
client = new TcpClient();
client.Connect( "10.0.55.12 ", 4312 );
stream = client.GetStrea m();
streamReader = new XmlTextReader( stream );
streamWriter = new XmlTextWriter( stream, new
System.Text.UTF 8Encoding() );
blablabla....
Thanks in advance
...Borgbjerg
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com