mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +03:00
phobos 0.176
This commit is contained in:
parent
00fe9a970d
commit
76dac5da92
18 changed files with 1233 additions and 40 deletions
44
std/socket.d
44
std/socket.d
|
@ -1593,3 +1593,47 @@ class Socket
|
|||
+/
|
||||
}
|
||||
|
||||
|
||||
/// TcpSocket is a shortcut class for a TCP Socket.
|
||||
class TcpSocket: Socket
|
||||
{
|
||||
/// Constructs a blocking TCP Socket.
|
||||
this(AddressFamily family)
|
||||
{
|
||||
super(family, SocketType.STREAM, ProtocolType.TCP);
|
||||
}
|
||||
|
||||
/// Constructs a blocking TCP Socket.
|
||||
this()
|
||||
{
|
||||
this(cast(AddressFamily)AddressFamily.INET);
|
||||
}
|
||||
|
||||
|
||||
//shortcut
|
||||
/// Constructs a blocking TCP Socket and connects to an InternetAddress.
|
||||
this(Address connectTo)
|
||||
{
|
||||
this(connectTo.addressFamily());
|
||||
connect(connectTo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// UdpSocket is a shortcut class for a UDP Socket.
|
||||
class UdpSocket: Socket
|
||||
{
|
||||
/// Constructs a blocking UDP Socket.
|
||||
this(AddressFamily family)
|
||||
{
|
||||
super(family, SocketType.DGRAM, ProtocolType.UDP);
|
||||
}
|
||||
|
||||
|
||||
/// Constructs a blocking UDP Socket.
|
||||
this()
|
||||
{
|
||||
this(cast(AddressFamily)AddressFamily.INET);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue