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?
mcaincAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vb_jonasConnect With a Mentor Commented:
I would put the communication in a class. Like so: http://www.eggheadcafe.com/articles/20020323.asp
0
 
mcaincAuthor Commented:
the socket object has its own class (SocketsClient).. i didn't know if that was relevant

but its a completely new object dimmed at Form1 just for this purpose
0
 
vb_jonasCommented:
Then, could you call the socketsclient from your infoclasses?
Also - how are you using threads in your app?
0
 
mcaincAuthor Commented:
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
0
 
vb_jonasCommented:
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?
0
All Courses

From novice to tech pro — start learning today.