Skip to content

Instantly share code, notes, and snippets.

@kristoff-it
Created August 21, 2019 20:48
Show Gist options
  • Save kristoff-it/3465cb69ca5f2b277dc6efdb5c382aab to your computer and use it in GitHub Desktop.
Save kristoff-it/3465cb69ca5f2b277dc6efdb5c382aab to your computer and use it in GitHub Desktop.
const sockfd = try os.socket(os.AF_INET, os.SOCK_STREAM, 0);
var sock_addr = os.sockaddr{
.in = os.sockaddr_in{
.len = 0,
.family = os.AF_INET,
.port = std.mem.nativeToBig(u16, 6379),
.addr = try std.net.parseIp4("127.0.0.1"),
.zero = [_]u8{0} ** 8,
},
};
try os.connect(sockfd, &sock_addr, @sizeOf(os.sockaddr));
var sock = std.fs.File.openHandle(sockfd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment