LemonBoy
7f46672193
More fixups for Windows targets
...
* Use closeSocket on sockets instead of plain old close, the latter
doesn't work on them.
* Use winsocket2 everywhere, mingw has no BSD sockets.
2020-10-28 10:03:23 +01:00
LemonBoy
8044ed4c66
std: Add basic smoke test for net functionality
2020-10-27 21:52:47 +01:00
johnLate
0a619c68a6
fix type mismatch in std.net.StreamServer
...
Parameter in std.os.listen is u31.
Fixes ziglang#6775
2020-10-25 21:18:24 -04:00
heidezomp
1e07487904
Fix std.net.connectUnixSocket in evented I/O mode
...
The event loop constant was missing.
2020-10-21 23:32:12 -04:00
Loris Cro
c196c27af8
recvfrom
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
419aea54cb
sendto
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
730428bfd6
connect
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Loris Cro
e85c89630e
accept
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Kenta Iwasaki
50e3906951
os: return error.SocketNotListening for EINVAL on accept ( #6226 )
2020-09-03 13:57:08 -04:00
LemonBoy
dd4994a4e4
std: Fix C-string with missing NUL terminator
...
Spotted thanks to the stricter conversion rules.
2020-09-01 18:45:35 +02:00
Andrew Kelley
4a69b11e74
add license header to all std lib files
...
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Andrew Kelley
d159ba9295
zig fmt
2020-08-04 23:04:20 -07:00
Jonathan Marler
6cc72af03d
Provide Ip4Address and Ip6Address in addition to Address
2020-07-27 07:11:07 +00:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted
2020-07-11 20:41:19 +03:00
joachimschmidt557
0ae1157e45
std.mem.dupe is deprecated, move all references in std
...
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
Andrew Kelley
d4d954abd2
std.sort: give comparator functions a context parameter
2020-06-08 15:16:40 -04:00
Ian Simonson
a6d1ef64d7
tcpConnectToHost try all addresses in AddressList
...
The AddressList returned can contain more than one item
e.g. the ipv4 and ipv6 addresses for a given hostname.
Previously if a server had multiple addresses but
was not listening on one of them Zig would give up
immediately.
Now on std.os.ConnectError.ConnectionRefused Zig will
try the next address in the list. Zig still gives up on
all other errors as they are related to the system and
system resources rather than whether the remote server
is listening on a particular address.
2020-06-07 22:39:35 +10:00
Andrew Kelley
7fd937fef4
cleanups
...
* improve docs
* add TODO comments for things that don't have open issues
* remove redundant namespacing of struct fields
* guard against ioctl returning EINTR
* remove the general std.os.ioctl function in favor of the specific
ioctl_SIOCGIFINDEX function. This allows us to have a more precise
error set, and more type-safe API.
2020-06-02 15:28:46 -04:00
Luna
0d091dc923
Replace os.linux to os.system
2020-06-02 14:56:19 -04:00
Luna
09c01ea7b9
Use resolveIp when looking up addresses on linux
2020-06-02 14:56:19 -04:00
Luna
c8468bed42
Add std.os.ioctl
2020-06-02 14:56:19 -04:00
Luna
b72c862725
Use IFNAMESIZE for scope id value
2020-06-02 14:56:06 -04:00
Luna
64e55a74de
Add validation for scope ids
2020-06-02 14:56:06 -04:00
Luna
11a06d4341
Remove warn() calls
2020-06-02 14:56:06 -04:00
Luna
cb649b769c
Fix ifreq definition
2020-06-02 14:56:06 -04:00
Luna
c50ac9a764
Change Unsupported to InterfaceNotFound
2020-06-02 14:56:06 -04:00
Luna
38109d48a3
Make interface name null-terminated before syscall
2020-06-02 14:56:06 -04:00
Luna
5919831529
Stop using mem.len on array
2020-06-02 14:56:06 -04:00
Luna
901aab8761
Add ioctl errors
2020-06-02 14:56:06 -04:00
Luna
2c641c93da
Only resolve scope id when needed
2020-06-02 14:56:06 -04:00
Luna
f02f4c0880
Fix typo and add if_nametoindex
2020-06-02 14:56:06 -04:00
Luna
b816303122
Add basics of resolveIp6
...
Instead of streaming the scope id digits to an u32, we keep a [32]u8 in
the stack and fill it up with the characters we get for scope id.
2020-06-02 14:56:05 -04:00
Jonathan Marler
58fb5b29b6
more windows network fixes
...
* support posix SOCK_NONBLOCK and SOCK_CLOEXEC flags on windows
* fix bugs in os.socket and os.connect to return at the correct place
2020-05-31 10:07:51 -06:00
Jonathan Marler
2bae91e769
convert getaddrinfo rc to enum before switching on it
2020-05-30 09:56:52 -06:00
Jonathan Marler
2eaab1e65e
more windows network support, including dns
2020-05-29 22:38:48 -06:00
Andrew Kelley
53d011fa1a
(breaking) std.time fixups and API changes
...
Remove the constants that assume a base unit in favor of explicit
x_per_y constants.
nanosecond calendar timestamps now use i128 for the type. This affects
fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes.
calendar timestamps are now signed, because the value can be less than
the epoch (the user can set their computer time to whatever they wish).
implement std.os.clock_gettime for Windows when clock id is
CLOCK_CALENDAR.
2020-05-24 21:40:08 -04:00
Jonathan Marler
832f6c1228
make Address.getOsSockLen pub
2020-05-11 09:11:05 -06:00
Haze Booth
e79d7e0ded
Remove fs.File artifact from connectUnixSocket
2020-05-09 12:29:27 -04:00
Vexu
10abffcd98
fix more private member access
2020-05-08 15:10:38 +03:00
Cato
9b788b765c
Pass filtered_sock_type to system.socket. Cover PermissionDenied error
2020-05-03 15:35:36 -04:00
Andrew Kelley
8a8beefa36
solve the problem with Darwin shims in std.os instead
...
* implement SOCK_NONBLOCK and SOCK_CLOEXEC Darwin shims in std.os
* revert changes to std.net
* remove os.accept and rename os.accept4 to os.accept
2020-05-02 17:36:28 -04:00
Cato
07bee9da42
Fixed Darwin-incompatible socket flags and unavailable system calls
2020-05-02 16:37:39 -04:00
Andrew Kelley
45bce27b8f
cleanup and fixes. behavior tests passing with evented I/O
2020-05-01 23:17:28 -04:00
xackus
cd20e0cc67
rename mem.separate to mem.split
2020-04-04 17:37:51 -04:00
xackus
7a28c644aa
new ArrayList API: fix everything else
2020-04-02 16:12:08 +02:00
Andrew Kelley
2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
...
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.
Also for consistency with ArrayList,
* `append` => `appendSlice`
* `appendByte` => `append`
Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
...
See #3811
2020-03-30 14:23:22 -04:00
Sebastian
2b0d66736a
tcpConnectToHost - fixed compilation error
...
before:
```
std\net.zig:403:23: error: type '@TypeOf(std.net.getAddressList).ReturnType.ErrorSet!*std.net.AddressList' does not support field access
const addrs = list.addrs.toSliceConst();
^
```
2020-03-28 21:34:50 -04:00
LemonBoy
541e763010
ir: Peer type resolution between ?[]T and *[N]T
...
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley
6b6f2fcf96
std.net: remove the hack from earlier in the branch
2020-03-19 15:09:52 -04:00