Client to concurrently receive and sending data on TCP socket

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Client to concurrently receive and sending data on TCP socket

lmdthel
Hi

I am looking into building an client application which connects to an existing server via an TCP socket. When the application has established the socket it must keep it open, and  receive and send requests (concurrently) around 2000 Req/s. 

What is the best design for such an application? Like:

- active or passive socket ?
- gen_server ?
- how many processes ?
- supervison tree ?

I have found examples of server and clients, but not an client which concurrently sends and receives data on the socket, does there exist anything similar applications i can look at ?

Thomas



 





 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Client to concurrently receive and sending data on TCP socket

John Doe
This https://github.com/brigadier/tara/blob/master/src/tara_worker.erl client concurrently sends and receives data. The protocol is supposed to be standard request -> reply, but replies are send asynchronously (though with little to no delay) with the IDs of the request. It uses gen_server with async handle_call which returns {noreply, Reason}
If I misunderstood what you mean by 'concurrently', then might be you just need a pool of such clients.

2017-03-17 1:18 GMT+03:00 Thomas Elsgaard <[hidden email]>:
Hi

I am looking into building an client application which connects to an existing server via an TCP socket. When the application has established the socket it must keep it open, and  receive and send requests (concurrently) around 2000 Req/s. 

What is the best design for such an application? Like:

- active or passive socket ?
- gen_server ?
- how many processes ?
- supervison tree ?

I have found examples of server and clients, but not an client which concurrently sends and receives data on the socket, does there exist anything similar applications i can look at ?

Thomas



 





 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Client to concurrently receive and sending data on TCP socket

dkuhlman
In reply to this post by lmdthel
It sounds like chapter 3 of the book "Erlang and OTP in action", by
Martin Logan et al, would be helpful to you.  The book is very
worthwhile, and you can also find the source code for the solutions
to the problems discuss in the book (including "TCP-based RPC
server" from chapter 3) at github:

    https://github.com/erlware/Erlang-and-OTP-in-Action-Source

Here is a bit of summary of the chapter:

    "What you're creating -- The RPC server will allow you to listen
    on a TCP socket and accept a single connection from an outside
    TCP client.  After it's connected, it will let a client run
    functions via a simple ASCII text protocol over TCP. ..."

Dave

On Thu, Mar 16, 2017 at 10:18:56PM +0000, Thomas Elsgaard wrote:

>    Hi
>    I am looking into building an client application which connects to an
>    existing server via an TCP socket. When the application has established
>    the socket it must keep it open, and  receive and send requests
>    (concurrently) around 2000 Req/s. 
>    What is the best design for such an application? Like:
>    - active or passive socket ?
>    - gen_server ?
>    - how many processes ?
>    - supervison tree ?
>    I have found examples of server and clients, but not an client which
>    concurrently sends and receives data on the socket, does there exist
>    anything similar applications i can look at ?
>    Thomas
>    Â 
>    Â 

> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions


--

Dave Kuhlman
http://www.davekuhlman.org
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...