summaryrefslogtreecommitdiff
path: root/LibCore/CTCPSocket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-10 20:22:23 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-10 20:22:23 +0200
commitcfd6e6cc3686ff5d9a10793cddf9d024a6bfac6d (patch)
tree5e28969da6f3f2ac1cc51fd9739edbfafe31d4ee /LibCore/CTCPSocket.cpp
parentfc1d3074de27fbcd0bf07e61781850f628fba0f1 (diff)
downloadserenity-cfd6e6cc3686ff5d9a10793cddf9d024a6bfac6d.zip
LibCore: Move GIODevice hierarchy from LibGUI to LibCore.
Diffstat (limited to 'LibCore/CTCPSocket.cpp')
-rw-r--r--LibCore/CTCPSocket.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/LibCore/CTCPSocket.cpp b/LibCore/CTCPSocket.cpp
new file mode 100644
index 0000000000..5f3702a482
--- /dev/null
+++ b/LibCore/CTCPSocket.cpp
@@ -0,0 +1,19 @@
+#include <LibCore/CTCPSocket.h>
+#include <sys/socket.h>
+
+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()
+{
+}