Click here to Skip to main content
15,888,025 members
Home / Discussions / C#
   

C#

 
GeneralRe: HTML EMail with embedded images Pin
Heath Stewart12-Feb-04 8:17
protectorHeath Stewart12-Feb-04 8:17 
GeneralHelp to TabControl / TabPage Pin
saabbaer12-Feb-04 4:03
saabbaer12-Feb-04 4:03 
GeneralRe: Help to TabControl / TabPage Pin
Heath Stewart12-Feb-04 4:13
protectorHeath Stewart12-Feb-04 4:13 
GeneralRe: Help to TabControl / TabPage Pin
saabbaer12-Feb-04 6:45
saabbaer12-Feb-04 6:45 
Questionhow to get cpu usage rate realtimely using C# Pin
yu-yu12-Feb-04 3:33
yu-yu12-Feb-04 3:33 
AnswerRe: how to get cpu usage rate realtimely using C# Pin
Heath Stewart12-Feb-04 4:10
protectorHeath Stewart12-Feb-04 4:10 
GeneralRe: how to get cpu usage rate realtimely using C# Pin
yu-yu12-Feb-04 13:01
yu-yu12-Feb-04 13:01 
GeneralXmlTextReader with a NetworkStream causes problems Pin
Borgbjerg11-Feb-04 23:00
Borgbjerg11-Feb-04 23:00 
We've got a multi-threaded server (we are very early in the project, trying to uncover some risks), and we 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

GeneralRe: XmlTextReader with a NetworkStream causes problems Pin
Heath Stewart12-Feb-04 4:04
protectorHeath Stewart12-Feb-04 4:04 
GeneralRe: XmlTextReader with a NetworkStream causes problems Pin
Borgbjerg12-Feb-04 4:30
Borgbjerg12-Feb-04 4:30 
GeneralRe: XmlTextReader with a NetworkStream causes problems Pin
Heath Stewart12-Feb-04 4:42
protectorHeath Stewart12-Feb-04 4:42 
GeneralGrant permission to access the Msysobjects Pin
Daminda11-Feb-04 21:18
Daminda11-Feb-04 21:18 
GeneralRe: Grant permission to access the Msysobjects Pin
Heath Stewart12-Feb-04 3:56
protectorHeath Stewart12-Feb-04 3:56 
GeneralImage into a database Pin
bengolong11-Feb-04 20:42
bengolong11-Feb-04 20:42 
GeneralRe: Image into a database Pin
Mazdak11-Feb-04 22:43
Mazdak11-Feb-04 22:43 
GeneralDeleting read-only files Pin
pankajdaga11-Feb-04 20:42
pankajdaga11-Feb-04 20:42 
GeneralRe: Deleting read-only files Pin
Colin Angus Mackay11-Feb-04 23:15
Colin Angus Mackay11-Feb-04 23:15 
GeneralRe: Deleting read-only files Pin
pankajdaga12-Feb-04 5:49
pankajdaga12-Feb-04 5:49 
GeneralRe: Deleting read-only files Pin
Tom Larsen12-Feb-04 5:13
Tom Larsen12-Feb-04 5:13 
GeneralRe: Deleting read-only files Pin
pankajdaga12-Feb-04 5:48
pankajdaga12-Feb-04 5:48 
GeneralHelp required......... Pin
shkhan11-Feb-04 20:16
shkhan11-Feb-04 20:16 
GeneralRe: Help required......... Pin
John Kuhn11-Feb-04 20:39
John Kuhn11-Feb-04 20:39 
GeneralDeep copy Hashtable Pin
RickardB11-Feb-04 20:15
RickardB11-Feb-04 20:15 
GeneralRe: Deep copy Hashtable Pin
Heath Stewart12-Feb-04 3:43
protectorHeath Stewart12-Feb-04 3:43 
GeneralRe: Deep copy Hashtable Pin
RickardB12-Feb-04 19:06
RickardB12-Feb-04 19:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.