How to design:Use One TCPIP Client connection to Server and work concurrently

R

ray

Hi all,
The system use ONE tcpip client and connection to server.
A large batch transactions send to server.I want to send to server concurrently.
any idea ?
In my thinking,
A.Devide large batch transactions to small batch transactions.
B.Create multi-thread or multiprocessing to process small transactions.
C.No idea at how to control multithread using ONE client concurrently?
Each small transactions do not need to wait others
Thank for your suggestions.
 
C

Chris Angelico

Hi all,
The system use ONE tcpip client and connection to server.
A large batch transactions send to server.I want to send to server concurrently.
any idea ?
In my thinking,
A.Devide large batch transactions to small batch transactions.
B.Create multi-thread or multiprocessing to process small transactions.
C.No idea at how to control multithread using ONE client concurrently?
Each small transactions do not need to wait others
Thank for your suggestions.

Are you able to open multiple TCP/IP connections to the server and run
them in parallel? If not, you're going to be limited to what the
server can do for you. Otherwise, though, it's just a matter of
working out how best to manage multiple connections.

* You can manage everything with a single thread and asynchronous I/O.
This would probably be easier if you're on Python 3.4, but it's
possible with any version.

* Or you can spin off threads, one for each connection. This can work
nicely, but if you don't know how to get your head around threads, you
may confuse yourself, as has been recently discussed in other threads
(discussion threads, that is, not threads of execution - what a
crackjaw language this English is!).

* Or you can use the multiprocessing module and divide the work into
several processes. Again, you have to figure out what you're doing
where, but this can in some ways be a lot easier than threading
because each process, once started, is completely separate from the
others.

* Or, rather than manage it within Python, you could simply start
multiple independent processes. Somehow you need to figure out how to
divide the transactions between them. Could be really easy, but could
be quite tricky. I suspect the latter, in this case.

There are many ways to do things; figuring out which is the One
Obvious Way demands knowledge of what you're trying to achieve. Do any
of the above options sound good to you?

ChrisA
 
R

ray

Hi all,
Because the server only can accept ONE connect from client.
If the client establish connection with the server,the server can not accept other client.
One large batch transaction file come from user.
client divide the large file to several smaller files.
In my thinking:
client have many seats.Each smaller files is thread.
client manage which seat was avaiable,handle send to/recv from server.
Any idea or suggestion?
 
C

Chris Angelico

Hi all,
Because the server only can accept ONE connect from client.
If the client establish connection with the server,the server can not accept other client.

Are you sure? If that's the case, you're stuck - you can't parallelize at all.
One large batch transaction file come from user.
client divide the large file to several smaller files.
In my thinking:
client have many seats.Each smaller files is thread.
client manage which seat was avaiable,handle send to/recv from server.
Any idea or suggestion?

A normal server setup would accept multiple connections at once. But
you'll need to look into what the server can actually do.

ChrisA
 
R

ray

In some enviroment,Client connect with Server(Always connect).
It is a little like pipe.Many requester use the pipe send request and receive reponse.In client side,it dispatch requests and handle/match response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top