Help with sockets

Recently I found out that codea can use luasockets. But I have no experience with network programming of any sort and I dont know where one starts a socket program code wise. My question is this, if you have any experience with sockets, could you pass on some pointers.
One specific thing that I’m wondering about, what should my framework code be that I build the rest or the project off of.
Thanks in advance for any help.

Don’t know much about sockets, but you are going to face an issue with Codea unlike in any other programming framework. Usually the easy way to learn about sockets is to have 2 little programs, a client and a server, and run them simultaneously. Because Codea only lets you run one process at a time (unless you have 2 ipads), the whole learning exercise is going to be more complicated.

So maybe you can find a simple lua socket server example that you can run from your computer and experiment with the client from your ipad.

I tried the python example a while ago - check [](Python sockets). There’s a lot of boiler plate to create the server, but then the core of the processing happens in a few callbacks that you implement.

@joelhoro I was able to make a UDP socket server in Java on my desktop that let me turn my iPad into a trackpad and keyboard.

@skythecoder that’s very cool!

@SkyTheCoder iPad as a giant trackpad? That’s something I would buy on the App Store.

From the ipad only, maybe you can use Pythonista to run the other side? Not sure about sockets though.
Or you could use Kodiak PHP if php on server side allows for sockets.

I won’t have an issue with number of devices to test my program.
The problem I foresee is would them being on the same IP address cause problems in testing.

@Archimedes Doesn’t every device have a different IP?

I think he might mean them all connecting to the same IP address, @SkyTheCoder

@SkyTheCoder @CodeaNoob
I did some looking and the devices in question have different ip 's so that won’t be a problem. The problem I foresee is that there are no socket lessons that I can find only documentation , which makes learning how to code sockets very difficult without knowing how the parts of a socket interact.

I found @JakAttak’s socket library very useful, you can check it out over on my other LuaSocket questions thread.

@Archimedes Your router will ensure that no two devices connected to it will have the same internal IPs. If a device tries to connect with an internal IP that’s already taken, if it’s a dynamic IP, it’ll automatically be assigned a new IP so no two will conflict, and if it’s a static IP, its connection will be refused. Also, there are probably some socket tutorials out there if you search around enough. I found @JakAttak’s Multiplayer class to be a great example, however.