Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.
/ net.odin Public archive

comprehensive network library for building network applications in Odin, providing a high-level interface for handling network sockets and protocols

Notifications You must be signed in to change notification settings

RestartFU/net.odin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Why is this archived?

because the odin language (finally) decided to add a networking library in the core packages I initially made this library because I wanted use odin to write programs that required networking features, and I did not want to use raw C bindings

Example

here is a basic example of a TCP client using net.odin

// basic example of the usage of net.odin
package example

import "core:fmt"
// you may change the import path to wherever you put the library.
import net "../"

main :: proc () {
    // connecting to the remote host.
    conn, ok := net.tcp_connect(":6969")
    if !ok {
        fmt.println("failed to connect")
        return
    }
    // make sure to close the socket once you're done with it.
    defer net.close(conn)
    
    // writing to the remote host.
    _, ok = net.write_string(conn, "hey")
    if !ok {
        fmt.println("failed to write")
        return
    }
    
    // reading incoming data from the remote host.
    str, ok2 := net.read_string(conn)
    if !ok2 {
        fmt.println("failed to read")
        return
    }
    
    // printing the received data.
    fmt.println(str)
}

About

comprehensive network library for building network applications in Odin, providing a high-level interface for handling network sockets and protocols

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages