TcpConnection
type TcpConnection = TcpConnection
A TCP network connection.
Implementions
Methods
connect
pub fn connect(addr: TcpAddr | string): TcpConnection throws IoError
[src]
pub fn connect(addr: TcpAddr | string): TcpConnection throws IoError {
switch (let addr = addr.(type)) {
case TcpAddr:
return try _TcpConnection.connect(addr as _TcpAddr) as TcpConnection;
case string:
let addr = try TcpAddr.parse(addr).ok_or_else(|| IoError.other("invalid address"));
return try _TcpConnection.connect(addr as _TcpAddr) as TcpConnection;
}
}
Opens a TCP connection to a remote host.
connect
pub fn connect(addr: TcpAddr | string): TcpConnection throws IoError
[src]
pub fn connect(addr: TcpAddr | string): TcpConnection throws IoError {
switch (let addr = addr.(type)) {
case TcpAddr:
return try _TcpConnection.connect(addr as _TcpAddr) as TcpConnection;
case string:
let addr = try TcpAddr.parse(addr).ok_or_else(|| IoError.other("invalid address"));
return try _TcpConnection.connect(addr as _TcpAddr) as TcpConnection;
}
}
Opens a TCP connection to a remote host.
Opens a TCP connection to a remote host.
Example
nv,no_run
use std.net.TcpConnection;
fn main() throws {
let conn = try TcpConnection.connect("example.com:80");
}
local_addr
pub fn local_addr(self): Addr?
[src]
pub fn local_addr(self): Addr? {
return try? (self as _TcpConnection).local_addr() as TcpAddr;
}
local_addr
pub fn local_addr(self): Addr?
[src]
pub fn local_addr(self): Addr? {
return try? (self as _TcpConnection).local_addr() as TcpAddr;
}
remote_addr
pub fn remote_addr(self): Addr?
[src]
pub fn remote_addr(self): Addr? {
return try? (self as _TcpConnection).remote_addr() as TcpAddr;
}
remote_addr
pub fn remote_addr(self): Addr?
[src]
pub fn remote_addr(self): Addr? {
return try? (self as _TcpConnection).remote_addr() as TcpAddr;
}
[src]
pub fn close(self) throws IoError {
try (self as _TcpConnection).close();
}
[src]
pub fn close(self) throws IoError {
try (self as _TcpConnection).close();
}
[src]
pub fn read(self, buf: Bytes): int throws IoError {
return try (self as _TcpConnection).read(buf);
}
[src]
pub fn read(self, buf: Bytes): int throws IoError {
return try (self as _TcpConnection).read(buf);
}
[src]
pub fn write(self, bytes: Bytes): int throws IoError {
return try (self as _TcpConnection).write(bytes);
}
[src]
pub fn write(self, bytes: Bytes): int throws IoError {
return try (self as _TcpConnection).write(bytes);
}