zouchengzhuo commented on issue #9214:
URL: https://github.com/apache/apisix/issues/9214#issuecomment-1527381835

   > sorry. I not found this usage at APISIX project.
   > 
   > ```
   > ~/w/apisix *master> ack 'socket.tcp' apisix/stream/plugins/
   > ~/w/apisix *master> ack 'ngx.req.socket' apisix/stream/
   > apisix/stream/plugins/mqtt-proxy.lua
   > 131:    local sock = ngx.req.socket()
   > ```
   > 
   > and
   > 
   > > When the raw argument is true, it is required that no pending data from 
any previous [ngx.say](https://github.com/openresty/lua-nginx-module#ngxsay), 
[ngx.print](https://github.com/openresty/lua-nginx-module#ngxprint), or 
[ngx.send_headers](https://github.com/openresty/lua-nginx-module#ngxsend_headers)
 calls exists. So if you have these downstream output calls previously, you 
should call 
[ngx.flush(true)](https://github.com/openresty/lua-nginx-module#ngxflush) 
before calling ngx.req.socket(true) to ensure that there is no pending output 
data. If the request body has not been read yet, then this "raw socket" can 
also be used to read the request body.
   
   There is the same problem when using ngx.req.socket(),the receive queue of 
tcp will be blocked when using sock:receive. 
   
   when using  sock:receiveany, the receive queue of tcp will not blocked,  but 
in this case, i have to manage the buffer myself.
   
   when using sock:receive, there may be some problems with the coroutine 
scheduling, causing the main coroutine to fail to resume.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to