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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vb_jonasCommented:
I would put the communication in a class. Like so: http://www.eggheadcafe.com/articles/20020323.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.