Commit Graph

20 Commits

Author SHA1 Message Date
PePerRoNii
c08d9c50c8 Changed TCP_Recv_Err to Socket_Info_Err and tested on darwin_arm64 2025-06-15 12:14:59 +07:00
PePerRoNii
42aa8ac383 Implemented _socket_info_error on peer_endpoint and bound_endpoint 2025-06-15 11:17:49 +07:00
PePerRoNii
c402ac8606 Add entry point in core:net as peer_endpoint 2025-06-11 12:44:17 +07:00
Jeroen van Rijn
bc86b50392 Replace default_tcp_options with constant (#5056)
Replace `default_tcp_options` with constant
2025-04-19 14:32:59 +02:00
Laytan Laats
ff7d55a8e1 net: rework errors to be cross-platform 2025-04-05 17:35:19 +02:00
Christiano Haesbaert
5699c533c6 Add net.dial_tcp_from_host{_or_endpoint} and unify them
The main motivation for this is to have sinergy with flags parsing, currently
flags for a sockaddr returns a net.Host_Or_Endpoint, but we can't just dial
from it since there isn't a variant.

Consider the following:

```
Options :: struct {
	target: net.Host_Or_Endpoint `args:"pos=0,required" usage:"host:port"`,
}

before :: proc() -> (sock: net.TCP_Socket, err: net.Network_Error) {
	opt: Options

	flags.parse_or_exit(&opt, os.args)
	switch t in opt.target {
	case net.Host:
		sock, err = net.dial_tcp(t.hostname, t.port)
	case net.Endpoint:
		sock, err = net.dial_tcp(t)
	}
	return
}

after :: proc() -> (sock: net.TCP_Socket, err: net.Network_Error) {
	opt: Options

	flags.parse_or_exit(&opt, os.args)
	sock, err = net.dial_tcp(opt.target)
	return
}

```

For completion, add dial_tcp_from_host() and define the upper functions in terms
of the newly added ones, cuts one repeated block, now:

from_hostname_and_port_string is parse + from_host_or_endpoint
from_hostname_with_port_override is parse + override + from_host_or_endpoint
from_host is to_endpoint + from_endpoint
from_host_or_endpoint is from_endpoint or from_host
2025-01-12 02:41:35 +01:00
gingerBill
327ca2ab71 Merge pull request #4261 from laytan/net-bound-endpoint
net: add `bound_endpoint` procedure
2024-09-19 12:53:42 +01:00
Laytan Laats
652557bfcd net: add bound_endpoint procedure 2024-09-17 22:22:19 +02:00
Karl Zylinski
19f0127e55 Moved all packages in core, base, vendor, tests and examples to use new #+ file tag syntax. 2024-09-14 18:27:49 +02:00
Feoramund
fe754af13d Add new contribution notes to core:net 2024-08-05 03:05:49 -04:00
Feoramund
e61d893a74 Port core:net to FreeBSD 2024-06-26 10:05:24 -04:00
Laytan Laats
3a0df80066 correct newly found vets 2024-04-03 00:52:58 +02:00
flysand7
8063569cdd [net]: Add send_any, recv_any variants to proc groups for Any_Socket 2023-11-24 23:27:12 +11:00
flysand7
4d65b1ab9c Implement new sys/unix package 2023-10-27 10:51:21 +11:00
Jeroen van Rijn
243a3f5006 Fix #2386 2023-03-16 12:35:05 +01:00
Sokus
1ecab2fcbc Add set_blocking for network sockets 2023-03-08 13:30:12 +01:00
Jeroen van Rijn
d939d6079a Don't try to check core:net on the BSDs. 2023-03-03 18:24:26 +01:00
Jeroen van Rijn
798932523e Coalesce socket_windows 2023-03-03 15:21:40 +01:00
Jeroen van Rijn
c02ff3af27 Update comments 2023-03-02 13:45:12 +01:00
Colin Davidson
28f7f57247 manually start merging core_net 2023-03-01 07:58:30 -08:00