MengRao / pollnet

A collection of non-blocking(polling) network libs for Linux, also support solarflare APIs(Tcpdirect/Efvi)
MIT License
213 stars 86 forks source link

无法发送给client #3

Closed jamesmasika closed 3 years ago

jamesmasika commented 4 years ago
    TcpdirectTcpServer server;
server.init(interface, listenIp, port);
using TcpConnection = TcpdirectTcpConnection;
using TcpConnectionPtr = std::unique_ptr<TcpConnection>;
TcpConnectionPtr client;
while(client == nullptr) {
    client = server.accept();
};
struct sockaddr_in c_addr;
client->getPeername(c_addr);
printf("clientip:%s\n",inet_ntoa(c_addr.sin_addr));
    int write_size = __SWP32(pHead->MsgLen) + 3 * sizeof(UINT32);
                  int nwrite = client->write(pMsg, write_size);
          if(nwrite != write_size){

            printf("send 300111 error %s\n", client->getLastError());
            //printf("erro no = %s\n", strerror(errno));
            continue;
        }

output: clientip:20.20.1.83 send 300111 error send 300111 error send 300111 error send 300111 error

jamesmasika commented 4 years ago

是不是获取client后还需要做什么操作?

jamesmasika commented 4 years ago

error zft_send_single EAGAIN Resource temporarily unavailable

MengRao commented 3 years ago

write的返回值类型是bool不是int