Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57510 > unrolled thread
| Started by | ray <yehrayyeh@gmail.com> |
|---|---|
| First post | 2013-10-25 03:06 -0700 |
| Last post | 2013-10-25 20:22 -0700 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.python
How to design:Use One TCPIP Client connection to Server and work concurrently ray <yehrayyeh@gmail.com> - 2013-10-25 03:06 -0700
Re: How to design:Use One TCPIP Client connection to Server and work concurrently Chris Angelico <rosuav@gmail.com> - 2013-10-25 21:25 +1100
Re: How to design:Use One TCPIP Client connection to Server and work concurrently ray <yehrayyeh@gmail.com> - 2013-10-25 17:48 -0700
Re: How to design:Use One TCPIP Client connection to Server and work concurrently Chris Angelico <rosuav@gmail.com> - 2013-10-26 12:09 +1100
Re: How to design:Use One TCPIP Client connection to Server and work concurrently ray <yehrayyeh@gmail.com> - 2013-10-25 20:22 -0700
| From | ray <yehrayyeh@gmail.com> |
|---|---|
| Date | 2013-10-25 03:06 -0700 |
| Subject | How to design:Use One TCPIP Client connection to Server and work concurrently |
| Message-ID | <0626cc7c-d4fd-4d6e-ac3d-9a85a725b5fb@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-10-25 21:25 +1100 |
| Subject | Re: How to design:Use One TCPIP Client connection to Server and work concurrently |
| Message-ID | <mailman.1505.1382696725.18130.python-list@python.org> |
| In reply to | #57510 |
On Fri, Oct 25, 2013 at 9:06 PM, ray <yehrayyeh@gmail.com> wrote: > 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
[toc] | [prev] | [next] | [standalone]
| From | ray <yehrayyeh@gmail.com> |
|---|---|
| Date | 2013-10-25 17:48 -0700 |
| Message-ID | <3ba1ddfc-3a7a-4644-bf64-004382242627@googlegroups.com> |
| In reply to | #57510 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-10-26 12:09 +1100 |
| Subject | Re: How to design:Use One TCPIP Client connection to Server and work concurrently |
| Message-ID | <mailman.1568.1382749754.18130.python-list@python.org> |
| In reply to | #57585 |
On Sat, Oct 26, 2013 at 11:48 AM, ray <yehrayyeh@gmail.com> wrote: > 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
[toc] | [prev] | [next] | [standalone]
| From | ray <yehrayyeh@gmail.com> |
|---|---|
| Date | 2013-10-25 20:22 -0700 |
| Message-ID | <145823a3-0125-41db-a807-3fae87051f47@googlegroups.com> |
| In reply to | #57510 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web