mcainc
asked on
Socket keeps dropping when I attempt to use a function to call it from another Class
I have 2 classes, and 10 instances of the 2nd class:
Form1
InfoClass (10)
In Form1 I have a socket that connects to a remote server and handles a series of queries... the problem is when I call Form1.SendQuery(query) from any of the instances of InfoClass the connection just drops.
If I send the exact same query from Form1, it works fine...
I just can't seem to call the query from the other classes/threads...
How do I do this properly?
Form1
InfoClass (10)
In Form1 I have a socket that connects to a remote server and handles a series of queries... the problem is when I call Form1.SendQuery(query) from any of the instances of InfoClass the connection just drops.
If I send the exact same query from Form1, it works fine...
I just can't seem to call the query from the other classes/threads...
How do I do this properly?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then, could you call the socketsclient from your infoclasses?
Also - how are you using threads in your app?
Also - how are you using threads in your app?
ASKER
the problem is i am trying to only have 1 connection to the remote server that all of the infoclasses share
if i use the socketsclient from my infoclasses then i would have to use 10 connections for each instance
if i use the socketsclient from my infoclasses then i would have to use 10 connections for each instance
Ok, how do you call your form from the infoclasses, Form1.SendQuery(query), is Form1 a shared class or an instance of Form1?
Do you check if the socket is busy when you call it?
Do you check if the socket is busy when you call it?
ASKER
but its a completely new object dimmed at Form1 just for this purpose