Socketserver
Download the latest version of SocketServer here
SocketServer is a very simple TCP server for Mac OS 10.5. It can be configured to run on localhost for development or kiosk-type installations or on your public ip to talk to other machines. It also has the ability to detect and connect to USB serial devices. Here are some possible uses for SocketServer:
- A very basic serial port proxy, allowing applications built in Flash to talk to the serial port through a network connection.
- A quick way to connect to a serial device connected to your mac; run SocketServer, open a telnet connection, and you are talking to the device.
- A chat server; all connected clients receive all messages passed to SocketServer, so if multiple machines are connected they can talk to each other through the server.
These are just a few possibilities of what can be done with SocketServer. I usually use it in conjunction with Telnet, but I have had great success using SocketServer with Flash, Processing, php scripts, ajax scripts, and just about any other platforms that support tcp network connections.
Setup of SocketServer:
- Double click the application to start SocketServer. This opens a configuration page.
- SocketServer can be configured to listen to either localhost or your remote ip on any port between 1024 and 65536.
- You can also attach end-of-line strings to all messages passing through SocketServer, useful for things like AS2 where a null is expected for EOL.
- Selecting hex interpretation allows clients to send hex characters in the form '&xx', where xx is the hex code for the character to be sent to connected clients.
- Auto-start server is mainly for installations, where SocketServer would be put in the default user's Login Items and would then auto-start without showing the configuration page.
- Show server/client connections and messages are useful for debugging but it is strongly suggested that these be disabled unless needed; the popups used by SocketServer steal focus and can be very annoying. I usually leave server/client connections enabled when trying to talk to devices and applications for the first time, then disable it for installations.
- Lastly, SocketServer looks through your /dev folder on startup for USB serial adapters. It will, on most macs, find Bluetooth adapters, but I have not tried playing with that much. More useful to me is when it finds FTDI adapters (so I can talk to my Arduinos) or Keyspan adapters (so I can talk to devices through rs232 cable). Ensure that the correct baud, bits, parity, stop bits, etc are selected for the device you are connecting to; changing these values means having to restart SocketServer.
Once running, Telnet can be used to verify that the server is accepting clients. From Terminal, type 'telnet 127.0.0.1 6780' (assuming you are running on localhost and port 6780). You should immediately connect to the server and can start passing messages back and forth with any other connected clients. (to exit telnet type [ctrl]-']', then type 'quit'.)
To shut the server down, run the SocketServer application again; it will detect that a server is running and ask you if you want to leave it running (Cancel) or shut it down (Shutdown). If you select Shutdown you will go to the configuration page, and from there you can select 'Cancel' to exit without starting a server.
Notes for version 0.7:
- Added ip check when using SocketServer on the remote ip; checks that the current ip matches what socketserver is listening to and restarts the server on the new ip if it has changed.
- Added hex interpretation option; to send a hex value, check the hex interpretation option and send hex values in the form '&xx'; for example, &07 will send a bell character.