Replies: 3 comments
-
|
Take a look at examples/socks4a/tcprelay.cc |
Beta Was this translation helpful? Give feedback.
-
|
@chenshuo Thanks. This example is really a great help for me, and there are so much to learn about muduo and asynchronous socket programming. In my program, a custom protocol is introduced into the app layer, which contains a 4-bytes message header to indicate the whole message length. In I'm really a newbie in asynchronous socket programming, and find myself lost in the callbacks. Any help would be appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
You should never issue a blocking call like recv() in an event handler, it may block all connections. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Yesterday I found 'muduo' on GitHub when random browsing, and find it very interesting and useful. After a quick browse of your code, I can't help to write some something on 'muduo'.
I want to write a simple TCP socket proxy using it. It will simply transfer what it receives to the back-end TCP server, and send back the response from the back-end server to the client. I'm not very good at C++, so I'm quite confused right now:
Can this be done by using muduo? And can it be done asynchronously? Should I start two EventLoop, one for listening from the client, the other for the back-end server? If so, how can these loops communicate with each other?
Any help would be appreciated.
I know this post is not an issue, sorry for the trouble.
Beta Was this translation helpful? Give feedback.
All reactions