?
Solved

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

Posted on 2012-03-30
3
Medium Priority
?
450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

762 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