• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

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

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
nielsen_t
Asked:
nielsen_t
  • 2
1 Solution
 
CodeCruiserCommented:
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
 
nielsen_tAuthor Commented:
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
 
CodeCruiserCommented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now