The Ti.Network.Socket.TCP and Ti.Network.Socket.UDP APIs should be as similar as we can possibly achieve. However they differ significantly at the most basic levels.
- TCP uses properties to set host/port then calls #listen() and #accept(), UDP uses #start(port, [host]) for starting a local socket
- TCP uses #close(), UDP uses #stop() to tear down the socket
- TCP uses properties to set host/port then calls #connect(), it's unclear to me how UDP handles connecting/sending data to a remote socket as a client.
- TCP has callbacks for accepted/connected (server got a connection, connected as a client); UDP has started/data (socket bound, socket received data).
- The properties/callbacks differ in naming of common properties, i.e. port is the same, but TCP uses host while UDP uses address.
- TCP forces you to use IOStream read/write methods (using Ti.Buffer); UDP has special methods for writing bytes (as Number) and Strings.