mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
ed66f1d6d4
This is pretty much a find/replace copy of CLocalServer, and some modifications to CTCPSocket and CSocketAddress to support it.
28 lines
581 B
C++
28 lines
581 B
C++
#include <LibCore/CTCPSocket.h>
|
|
#include <sys/socket.h>
|
|
#include <errno.h>
|
|
|
|
CTCPSocket::CTCPSocket(Badge<CTCPServer>, int fd, CObject* parent)
|
|
: CSocket(CSocket::Type::TCP, parent)
|
|
{
|
|
set_fd(fd);
|
|
set_mode(CIODevice::ReadWrite);
|
|
set_error(0);
|
|
}
|
|
|
|
CTCPSocket::CTCPSocket(CObject* parent)
|
|
: CSocket(CSocket::Type::TCP, parent)
|
|
{
|
|
int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
|
if (fd < 0) {
|
|
set_error(fd);
|
|
} else {
|
|
set_fd(fd);
|
|
set_mode(CIODevice::ReadWrite);
|
|
set_error(0);
|
|
}
|
|
}
|
|
|
|
CTCPSocket::~CTCPSocket()
|
|
{
|
|
}
|