Added dlistener.d

This commit is contained in:
Tristan B. Kildaire 2020-11-03 10:34:58 +02:00
parent a246ef1d73
commit 41d758c46a
1 changed files with 26 additions and 0 deletions

26
source/dnetd/dlistener.d Normal file
View File

@ -0,0 +1,26 @@
module dnetd.dlistener;
import std.socket;
public final class DListener
{
/**
* Creates new listener with the associated server
* and the given Add
*
*/
this(AddressInfo addressInfo)
{
/* Get the Address */
Address address = addressInfo.address;
/* TODO: Check AF_FAMILY (can only be INET,INET6,UNIX) */
/* TODO: Check SocketType (can only be STREAM) */
/* TODO: Check Protocol, can only be RAW (assuming UNIX) or TCP */
/* Create the Socket */
socket = new Socket();
socket.bind(address.addressFamily, addressInfo.type, addressInfo.protocol);
}
}