Solved

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

Posted on 2012-03-30
3
447 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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