Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,14 @@
with GNAT.Sockets; use GNAT.Sockets;
procedure Socket_Send is
Client : Socket_Type;
begin
Initialize;
Create_Socket (Socket => Client);
Connect_Socket (Socket => Client,
Server => (Family => Family_Inet,
Addr => Inet_Addr ("127.0.0.1"),
Port => 256));
String'Write (Stream (Client), "hello socket world");
Close_Socket (Client);
end Socket_Send;

View file

@ -0,0 +1,7 @@
Func _HelloWorldSocket()
TCPStartup()
$Socket = TCPConnect("127.0.0.1", 256)
TCPSend($Socket, "Hello World")
TCPCloseSocket($Socket)
TCPShutdown()
EndFunc

View file

@ -0,0 +1,38 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
const char *msg = "hello socket world";
int main()
{
int i, sock, len, slen;
struct addrinfo hints, *addrs;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
{
sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
if ( sock >= 0 )
{
if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
{
const char *pm = msg;
do
{
len = strlen(pm);
slen = send(sock, pm, len, 0);
pm += slen;
} while ((0 <= slen) && (slen < len));
}
close(sock);
}
freeaddrinfo(addrs);
}
}

View file

@ -0,0 +1,26 @@
#include <winsock2.h>
#include <assert.h>
// link winsock (MSVC extension. Ignored by MinGW)
#pragma comment(lib, "ws2_32.lib")
const char MESSAGE[] = "hello socket world";
int main() {
WSADATA wsa;
WSAStartup(MAKEWORD(2, 2), &wsa);
SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in server = {
.sin_family = AF_INET,
.sin_port = htons(256),
.sin_addr.s_addr = inet_addr("127.0.0.1")
};
assert(connect(s, (struct sockaddr *)&server, sizeof(server)) == 0);
send(s, MESSAGE, sizeof(MESSAGE) / sizeof(char), 0);
closesocket(s);
WSACleanup();
return 0;
}

View file

@ -0,0 +1,5 @@
(let ((proc (make-network-process :name "my sock"
:host 'local ;; or hostname string
:service 256)))
(process-send-string proc "hello socket world")
(delete-process proc))

View file

@ -0,0 +1,8 @@
open System.Text
open System.Net.Sockets
let sock =
new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
sock.Connect("127.0.0.1", 256)
sock.Send(Encoding.UTF8.GetBytes "hello socket world")
sock.Close

View file

@ -0,0 +1,14 @@
package main
import "core:fmt"
import "core:net"
MSG: string : "hello socket world"
main :: proc() {
sock, err := net.dial_tcp("127.0.0.1:256")
if err != nil do fmt.panicf("Connection failed: %v", err)
_, err = net.send(sock, transmute([]u8)MSG)
if err != nil do fmt.panicf("Error sending: %v", err)
}

View file

@ -0,0 +1,9 @@
local socket = require "pluto:socket"
local host, port, transport = "localhost", 256, "udp"
local s = socket.connect(host, port, transport)
if s then
s:send("hello socket world")
s:close()
else
print($"Unable to connect to '{host}' on port: {port} using {transport}")
end