Solved

vb.net app. using ipworks ipport avoid multiple connections to ip server

Posted on 2012-03-30
3
437 Views
Last Modified: 2012-06-21
Hello Experts,

I'm working on a VB.net application using IPWorks IPPort component.

I have a main form in my application using IPWorks IPPort component to receive data from an ip-server.
I have several forms in the application, that also should use the the IPPort component to communicate with the ip-server.
I would like to avoid that each forms ipport component creates a connection to the ip-server, but uses the IPPort in the application main form (which is always loaded).
Also when the application receives data from the ip-server, it should be possible to identify to which form the data (send from the ip-server) belongs.

Can somebody help with this?

Kind regards
Thomas
0
Comment
Question by:nielsen_t
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37795510
Sharing the connection is easy. Put it in a module

>it should be possible to identify to which form the data (send from the ip-server) belongs.

That would be the tricky bit. One option is to maintain the current form name who has sent anything to the server and when the response comes back, you post it to the current form.
0
 

Author Comment

by:nielsen_t
ID: 37798368
CodeCruiser, thanks for the answer.

But when sharing the connection, won't there be issues with synchronization. Eg. if multiple threads accessing the ipport at the same time?

Is it possible to show how to use the ipport within a module?

Regards
Thomas
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37802133
You would need to implement a complex solution to avoid issues when sharing. One option is to implement a queue. Each form calls a function which then queues the request. These is a thread which gets an item from the queue at a time, sends it over, waits for the response, posts the response back to form and then moves on to next item.

>Is it possible to show how to use the ipport within a module?

Just declare it as public/friend inside a modules file (Add New Item->Module)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now