diff options
Diffstat (limited to 'src/shared/lua_api/load_net.cpp')
| -rw-r--r-- | src/shared/lua_api/load_net.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shared/lua_api/load_net.cpp b/src/shared/lua_api/load_net.cpp index 04a9239..d8d321a 100644 --- a/src/shared/lua_api/load_net.cpp +++ b/src/shared/lua_api/load_net.cpp @@ -10,20 +10,20 @@ ect. --Server local s = net.newsocket(net.REP) s:bind("tcp://127.0.0.1:8765") - s:receive(function(stream) + function s:receive(stream) local message = stream:readstring() s:send("pong",function(stream) stream:writestring(message .. " world!") end) - end) + end @usage --Client local c = net.newsocket(net.REQ) c:connect("tcp://127.0.0.1:8765") - c:receive(function(stream) + c:receive(stream) print(stream:readstring()) - end) + end c:send(function(stream) stream:writestring("Hello,") end) @@ -378,8 +378,8 @@ void gameloop_net(lua_State* L){ if(err){ switch(err){ case NNG_EAGAIN: break; - case NNG_ESTATE: - if(stype == REQ) break; + //case NNG_ESTATE: + //if(stype == REQ) break; default: printf("Net error: %s\n\tSocket type:%d\n",nng_strerror(err),stype); lua_pushstring(L,"Error while receving message:"); @@ -535,7 +535,6 @@ int send(lua_State* L){ //lua_getfield(L,-1,"n");//{socket},type //int sockettype = lua_tonumber(L,-1); //lua_pop(L,2);// - //switch(sockettype //netfuncs[fd] = func;// //nettypes[fd] = sockettype; //return 0; |
