Hi,
I managed to got it to work now. It was a stupid mistake, since I
input the port number wrongly.
Thanks.
Regards
KK
2008/8/29 kk yap <[EMAIL PROTECTED]>:
> Hi,
>
> Yes, indeed it seems like Co_thread requires the wait and block. So I
> end up using tcp-socket.hh in NOX, following the ssl-test as example.
> I have got the thread running. Also, I have binded and listen to the
> socket without an error. With the code below, I tried a tcp
> connection to the server.
>
> void simulator_server::run()
> {
> VLOG_DBG(lg,"simulator server socket is alive!"); <=== seen
>
> int error;
> while (true)
> {
> server_sock.accept_wait();
> VLOG_DBG(lg,"accept waited"); <=== seen
> co_block();
> VLOG_DBG(lg,"block done"); <=== not seen!!!!!
> std::auto_ptr<Tcp_socket> new_socket = server_sock.accept(error, true);
> new simulator_connection(new_socket);
> }
> if (error != EAGAIN)
> lg.err("simulator TCP accept: %d",error);
> }
>
> Can someone explain what does co_block do and why I cannot have a
> connection accepted?
>
> Thanks.
>
> Regards
> KK
>
>
>
> However, it seems like
>
> 2008/8/28 Ben Pfaff <[EMAIL PROTECTED]>:
>> "kk yap" <[EMAIL PROTECTED]> writes:
>>
>>> I was creating a threaded NOX application (in C/C++). I used the
>>> cooperative thread class provided and has sucessfully spawned a
>>> thread. However, it seems like my thread takes up all the processing.
>>> The new thread basically runs server socket listening for messages,
>>> which is tested to be working. Though the rest of the NOX
>>> applications seems to have come to a standstill.
>>
>> You need to use the cooperative thread functions to wait for
>> events. See include/threads/cooperative.hh, especially
>> Co_task::fd_wait() and Co_thread::block().
>> --
>> Ben Pfaff
>> Nicira Networks, Inc.
>>
>
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org