[TIMOB-26195] Parity: Ti.Network.Socket.UDP API differs significantly from Ti.Network.Socket.TCP API
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android, TiAPI, Windows |
Labels | engArch, parity |
Reporter | Christopher Williams |
Assignee | Unknown |
Created | 2018-07-10T19:25:27.000+0000 |
Updated | 2019-11-23T15:08:27.000+0000 |
Description
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.
Specifically:
- 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.
This would help a lot for iOS and Android. The Ti.UDP module is not supported by SDK 7/8....