Data update

This commit is contained in:
Ingy döt Net 2024-03-06 22:25:12 -08:00
parent ed705008a8
commit 0df55f9f24
2196 changed files with 32999 additions and 3075 deletions

View file

@ -3,6 +3,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
const char *msg = "hello socket world";

View file

@ -1,5 +1,6 @@
"""Connect to a socket. Requires Python >= 3.2."""
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world")
sock.close()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect(("localhost", 256))
sock.sendall(b"hello socket world")

View file

@ -1,4 +1,4 @@
/* sockets.wren */
/* Sockets.wren */
var AF_UNSPEC = 0
var SOCK_STREAM = 1
@ -63,6 +63,8 @@ if (AddrInfo.getAddrInfo("localhost", "256", hints, addrInfoPtr) == 0){
if (slen < 0 || slen >= len) break
pm = pm[slen..-1]
}
} else if (stat == -1) {
System.print("Connection refused.")
}
var status = Socket.close(sock)
if (status != 0) System.print("Failed to close socket.")

View file

@ -1,3 +1,5 @@
/* gcc Sockets.c -o Sockets -lwren -lm */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -198,7 +200,7 @@ int main(int argc, char **argv) {
config.bindForeignMethodFn = &bindForeignMethod;
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "sockets2.wren";
const char* fileName = "Sockets.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
switch (result) {