![]() ![]() So tell me what you think and if it even works on your devices in your LAN.It’s been a while since we wrote a blog post (sorry about that!) but we haven’t been idle! Since the last update we’ve released all these new versions of Gideros: You can check the code and comments right now, if you want to know more.įile a contains the Server and Client classes,Īnd in a is the scene of drawing, where it does not matter anymore whether you are server or client, you simply call functions on all other devices and that's it. Then on clients device a button draw will appear, when you accept all clients you want, you may start drawing together Then there will be list of servers, to which you can join, then on server device you need to accept this device. Then select one of them as server, and on other devices select option to join. You need to start project simultaneously on multiple devices (or PC and device, also with some PC's, depending on configuration, firewall, etc discovering might not work). So I added a project for anyone who wants to test. Will keep updating snippet and probably someday create a tutorial " \r \n" ) elseĬlient:send ( "Unknown command: ".line. " \r \n" ) elseif line = "whattimeisit" thenĬlient:send (socket.gettime ( ). " \r \n" ) elseif line = "howdidigethere" thenĬlient:send (client:getsockname ( ). ![]() port ) print ( "After connecting, you have 10s to enter a line to be echoed" ) - loop forever waiting for clients local clients = while 1 do local ready, none, erra = lect (clients, writeClient, 10 ) if err = nil then for i = 1, maxClients do local client = clients if client = nil then - wait for a connection from any clientĬlient = server:accept ( ) - make sure we don't block waiting for this client's lineĮnd end end for i = 1, #ready do local client = ready - receive the line local line, err = client:receive ( ) - if there was no error, send it back to the client if not err then if line = "exit" then - done with client, close the objectĬlients = nil elseif line = "whoami" thenĬlient:send (client:getpeername ( ). load namespace local socket = require ( "socket" ) local ip, t = ( "localhost" ) - create a TCP socket and bind it to the local host, at any port local server = assert (socket.bind (ip, 53882 ) ) - find out which port the OS chose for us local ip, port = server:getsockname ( ) - print a message informing what's up print ( "Please telnet to ".ip. I'm probably doing something completely wrong using while loop. And when I check Gideros player it's simply hangs (Not responding). Which allows me to connect to localhost through putty on same port, but then after some time it says server has stopped unexpectedly. " \n" ) end - done with client, close the object port ) print ( "After connecting, you have 10s to enter a line to be echoed" ) - loop forever waiting for clients while 1 do - wait for a connection from any client local client = server:accept ( ) - make sure we don't block waiting for this client's lineĬlient:settimeout ( 10 ) - receive the line local line, err = client:receive ( ) - if there was no error, send it back to the client if not err then client:send (line. load namespace local socket = require ( "socket" ) local ip, t = ( "localhost" ) - create a TCP socket and bind it to the local host, at any port local server = assert (socket.bind (ip, 53883 ) ) - find out which port the OS chose for us local ip, port = server:getsockname ( ) - print a message informing what's up print ( "Please telnet to ".ip. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |