summaryrefslogtreecommitdiffhomepage
path: root/examples/simple_unique_socket/example.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-03 02:36:37 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-03 02:36:37 -0500
commitd43fed8fb9eb369adc70a57bc2a9552d36485241 (patch)
tree848f54bb8ab63b1cb1fbbf98f2a0b8a08ea153cf /examples/simple_unique_socket/example.cc
parentc3b474e38d0f974163cb392626e15f909c5a1b73 (diff)
chore: new `unique_socket` example and new public API.
chore: new parser public API. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples/simple_unique_socket/example.cc')
-rw-r--r--examples/simple_unique_socket/example.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/simple_unique_socket/example.cc b/examples/simple_unique_socket/example.cc
new file mode 100644
index 0000000..a0eaff2
--- /dev/null
+++ b/examples/simple_unique_socket/example.cc
@@ -0,0 +1,22 @@
+#include <net/unique_socket.hpp>
+#include <io/print.hpp>
+
+/// @brief Basic Send test
+int main()
+{
+ ocl::unique_socket sock = ocl::unique_socket::make_socket<8005>(ocl::unique_socket::any_address, true);
+
+ char buf_dst[512] = {"HELLO, WORLD\0"};
+
+ ocl::unique_socket sock2 = ocl::unique_socket::make_socket<8005>(ocl::unique_socket::any_address, false);
+
+ char buf_dst2[512] = {0};
+
+ auto new_sock = sock.accept();
+ new_sock.write_from_buffer(buf_dst, strlen(buf_dst));
+ sock2.read_client_buffer(buf_dst2, strlen(buf_dst));
+ std::cout << "result:" << buf_dst2 << "\n";
+
+
+ return EXIT_SUCCESS;
+}