dart:io
RawSynchronousSocket class
A low-level class for communicating synchronously over a TCP socket.
Warning: RawSynchronousSocket should probably only be used to connect to 'localhost'. The operations below will block the calling thread to wait for a response from the network. The thread can process no other events while waiting for these operations to complete. RawSynchronousSocket is not suitable for applications that require high performance or asynchronous I/O such as a server. Instead such applications should use the non-blocking sockets and asynchronous operations in the Socket or RawSocket classes.
Constructors
- RawSynchronousSocket()
Properties
- address → InternetAddress
read-only
- The InternetAddress used to connect this socket.
- hashCode → int
read-only, inherited
- The hash code for this object.
- port → int
read-only
- The port used by this socket.
- remoteAddress → InternetAddress
read-only
- The remote InternetAddress connected to by this socket.
- remotePort → int
read-only
- The remote port connected to by this socket.
- runtimeType → Type
read-only, inherited
- A representation of the runtime type of the object.
Methods
- available() → int
- The number of received and unread bytes in the socket that can be read.
- closeSync() → void
- Closes the RawSynchronousSocket.
- noSuchMethod(Invocation invocation) → dynamic
inherited
- Invoked when a non-existent method or property is accessed.
- readIntoSync(List<int> buffer, [int start = 0, int? end]) → int
- Reads bytes into an existing
buffer. - readSync(int bytes) → List<int>?
- Reads up to
bytes bytes from the socket. - shutdown(SocketDirection direction) → void
- Shuts down a socket in the provided direction.
- toString() → String
inherited
- A string representation of this object.
- writeFromSync(List<int> buffer, [int start = 0, int? end]) → void
- Writes from a
buffer to the socket.
Operators
- operator ==(Object other) → bool
inherited
- The equality operator.
Static Methods
- connectSync(dynamic host, int port) → RawSynchronousSocket
- Creates a new socket connection and returns a RawSynchronousSocket.