bidirectional communication on the same socket?

41 views
Skip to first unread message

dan.b...@huawei.com

unread,
Oct 31, 2018, 10:35:17 AM10/31/18
to grpc.io
Once establishing a connection from one service (behind a firewall) to another service, 
is it correct that gRPC can now use the established connection to initiate requests on either side?

If there's a pointer to some example demonstrating such bidirectional communication that would be great.

Thanks,
Dan

robert engels

unread,
Oct 31, 2018, 10:49:21 AM10/31/18
to dan.b...@huawei.com, grpc.io
If you mean using the ‘streaming’ protocol, you can look at github.com/robaho/keydbr which uses a bi-directional stream and the code is fairly simple.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/99c9d361-df3b-4d09-a9fa-3fc331b064db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dan.b...@huawei.com

unread,
Oct 31, 2018, 10:53:57 AM10/31/18
to grpc.io
Not necessarily for streaming. For sending requests and receiving synchronous or asynchronous responses. (unless I completely misunderstand what streaming means)

robert engels

unread,
Oct 31, 2018, 11:09:24 AM10/31/18
to dan.b...@huawei.com, grpc.io
It is my understanding - but I may be mistaken here - is that a gRPC “session” is uni directional unless you use streaming (that being said, a server can send unsolicited “responses” - which may be treated like a request to the client- to a client).

My continued confusion is that I believe the standard gRPC session is transient - in that it may close the connection after each request - and it may send a subsequent request to a completely different server, or on a new connection. The only time this is not the case is if the session is in streaming mode.


Srini Polavarapu

unread,
Nov 3, 2018, 10:54:37 PM11/3/18
to grpc.io
I think the OP is asking if server can start a request to client after client (behind a firewall) has established a gRPC connection to the server. The answer is no. See discussion here https://github.com/grpc/grpc/issues/14101. It is possible in gRPC-Go in a convoluted way. See https://github.com/grpc/grpc-go/issues/484

dan.b...@huawei.com

unread,
Nov 4, 2018, 4:57:22 AM11/4/18
to grpc.io
This is exactly what I meant, and I understand that the answer.

Is it possible to open two sockets (from behind the firewall to a public IP) and establish one of them as a gRPC connection from behind the firewall out, and the other as a gRPC from the outside into the firewalled system?
(e.g. client->server client<-server)
Reply all
Reply to author
Forward
0 new messages