By looking at the docs of zig's standard library I found out that it actually does have some functions for socket programming. But I just don't know how to use them as they are not documented completely.
To create a socket, one can use std.os.socket() function which takes three arguments: domain, socket_type, protocol. They are all of type u32. Now I have done socket programming in Python. In python there are some predefined variables like socket.AF_INET and socket.SOCK_STREAM which you can use as argument for the socket.socket function which takes address_family and protocol arguments. But I couldn't find such variables in zig's docs so I don't know what should be the value of these arguments.
Also After defining the socket using os.socket() function, one can use os.bind() function which takes 3 arguments: sock, addr, len. obviously sock is the created socket but what should be supplied as address and length? I'm also baffled about os.accept() function. it takes addr, addr_size and flags arguments. I have no idea what values should go there too.