/lib/titanium/mobile/network/Socket.hx

http://github.com/visup/haxe-titanium-api · Haxe · 64 lines · 15 code · 5 blank · 44 comment · 0 complexity · 827dd2eded6982f6f9c038186f3fa0c3 MD5 · raw file

  1. package titanium.mobile.network;
  2. import titanium.mobile.core.Dispatcher;
  3. import titanium.mobile.core.Buffer;
  4. import titanium.mobile.IOStream;
  5. import titanium.mobile.network.socket.TCP;
  6. /**
  7. Socket class
  8. Documentation available at:
  9. http://developer.appcelerator.com/apidoc/mobile/1.7.0.RC1/Titanium.Network.Socket-module
  10. - namespace
  11. Titanium.Network.Socket
  12. - type
  13. module
  14. - description
  15. Socket module
  16. - since
  17. 1.7
  18. - platforms
  19. iphone, android, ipad
  20. - properties
  21. INITIALIZED[Number]: state representing the initialized state of a socket
  22. CONNECTED[Number]: state representing the connected state of a socket
  23. LISTENING[Number]: state representing the listening state of a socket
  24. CLOSED[Number]: state representing the closed state of a socket
  25. ERROR[Number]: state representing the error state of a socket
  26. - methods
  27. createTCP: returns new TCP socket object, takes object containing properties list defined in `Titanium.Network.Socket.TCP`. Some properties are only needed based on whether the socket will be a connecting socket or a listening socket.
  28. - method : createTCP, `Titanium.Network.Socket.TCP`
  29. params[Object]: creation parameters
  30. **/
  31. @:native("Titanium.Network.Socket")
  32. extern class Socket extends Dispatcher, implements IOStream
  33. {
  34. // static methods
  35. public static function createTCP(params:Dynamic):TCP;
  36. // implemented methods
  37. public function read( buffer:Buffer, ?offset:Int, ?length:Int ):Int;
  38. public function write( buffer:Buffer, ?offset:Int, ?length:Int ):Int;
  39. public function isWriteable():Bool;
  40. public function isReadable():Bool;
  41. public function close():Void;
  42. }