socket

Generated by tinox doc

tinox.core.socket, bundled with the compiler and also available as a standalone tinox-central package.

Tcp client

import tinox.core.socket
class Main
{
    fnc main() -> Int32
    {
        const client: Socket = Socket::createTcp()
        if (Socket::connect(client, "localhost", 8080))
        {
            Socket::send(client, "Hello Server!")
            const response: String = Socket::receive(client, 1024)
            println(response)
            Socket::close(client)
        }
        return 0
    }
}

fn socketCreateTcp() → Int64

fn socketCreateUdp() → Int64

fn socketConnect(fd: Int64, host: String, port: Int64) → Bool

fn socketBind(fd: Int64, port: Int64) → Bool

fn socketListen(fd: Int64) → Bool

fn socketAccept(fd: Int64) → Int64

fn socketSend(fd: Int64, data: String) → Int64

fn socketReceive(fd: Int64, size: Int64) → String

fn socketClose(fd: Int64) → Nothing

class Socket

Fields

handleInt64
modeString

Methods

fn createTcp() → Socket
fn createUdp() → Socket
fn connect(socket: Socket, host: String, port: Int64) → Bool
fn bind(socket: Socket, port: Int64) → Bool
fn listen(socket: Socket) → Bool
fn accept(socket: Socket) → Socket
fn send(socket: Socket, data: String) → Int64
fn receive(socket: Socket, size: Int64) → String
fn close(socket: Socket) → Nothing