Commit Graph

68 Commits

Author SHA1 Message Date
5a7e3f0888 fix(build): Use gai_strerrorA not gai_strerror on Windows
* Explicitly call gai_strerrorA (for Windows builds), so that the code work correctly in 32bit or 64bit builds.

* Implement GAI_STRERROR macro to deal with Windows vs. Non-Windows compiles for 64-bit.

* make usocket.c consistent with other modules that call macro GAI_STRERROR

* Use different name not just different case for macro wrapping function

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2022-07-27 09:51:35 +03:00
611cdd19cc inet: pragma visibility 2019-03-10 00:03:04 -07:00
731b23bc89 inet.c: use LUASOCKET_PRIVATE 2019-02-25 15:58:54 -07:00
83880dbed7 When zero-timeout, only try first address in connect. 2015-12-03 12:56:18 -02:00
77bba625d7 Fixes suggested by @Florob in #147. 2015-08-25 15:41:40 -03:00
96965b179c New agnostic IPv4 IPv6 functions.
Also dealing with EPROTOTYPE Yosemite seems to be throwing
at us for no reason.
2015-08-22 19:52:01 -03:00
e75444ccd1 New compat.h module implements luaL_setfuncs.
Makes initialization code simpler everywhere.
2015-08-21 15:39:34 -03:00
76ed24fe8a Fix inet_global_getaddrinfo leak of getnameinfo
Issue #127 closed.
2015-02-18 20:54:27 -02:00
b1d1e721d1 No need for inet_pton. 2013-06-04 16:26:49 +08:00
5eefc73b57 Remove warnings. Move windows specific code. 2013-05-30 16:50:28 +08:00
a233e27865 Leaving if in src/ but out of build for now. 2013-05-30 16:20:34 +08:00
79e6c4915d Export global only if LUA_COMPAT_MODULE defined. 2013-05-29 16:56:56 +08:00
2d51d61688 Fix "final" bug in pton and TCP connreset handling 2013-05-28 17:27:06 +08:00
734cc23e1f Fixed inet_pton and a new Winsock UDP bug.
inet_pton was copying the entire sockaddr_in struct,
rather than just the sin_addr field...

I am a bit unsure about the UDP fix, because it may affect
TCP as well. On UDP sockets, when a sendto fails, the next
receive/receivefrom fails with CONNRESET. I changed
sock_recv/sock_recvfrom in wsocket.c to skip the CONNRESET
from the recv/recvfrom, hoping that if the socket is TCP,
sock_waitfd will get the CONNRESET again. The tests pass,
but this should be tested more thoroughly.
2013-05-28 00:09:30 +08:00
834a3cf520 Simplifying getaddrinfo treatment. 2013-05-27 21:05:48 +08:00
5e0b56b8d3 Merge branch 'moteus' of https://github.com/moteus/luasocket into moteus 2013-05-27 20:32:54 +08:00
26704061a4 Fix Visual Studio 2012 projects 2013-05-27 20:30:06 +08:00
e54f78c61c Fix. setsockname fails with "*" as host.
Add. test_bind.lua
2013-05-27 11:25:31 +04:00
56dbda39ed Fix. getaddrinfo returns garbage as address on Windows.
Add. test_getaddrinfo.lua
2013-05-27 11:20:52 +04:00
427220c7b1 Merge tryconnect6 into inet_tryconnect. 2013-05-26 21:26:26 +08:00
bb0b31301a Add MingW support. 2013-05-25 18:07:38 +08:00
5a58786a39 Added inet_pton/inet_ntop for MinGW on Windows; compiles with Lua52. 2013-04-07 12:39:56 -07:00
72a5347f97 Remove warnings and fix makefile for Win32. 2012-12-11 17:43:49 -02:00
618ce43ee3 Fix socket_accept usage to depend on family. 2012-12-11 16:35:27 -02:00
6368caeb5a Fix udp:setpeername("*")
There seems to be a curious difference between MacOS and
Linux and I am not sure if this is documented. When you
break a "connection" on Mac OS, you only eliminate the peer
association, but the local address remains bound. On Linux,
breaking a "connection" eliminates the binding to the local
address. Have you guys ever come accross this?

Another irritating difference is that connect() returns the
error EAFNOSUPPORT on Mac OS. I am going to ignore all
errors when the reason for calling connect() is simply to
break the "connection".
2012-08-23 19:31:15 -03:00
156669c28b socket.connect now implemented in the C core
This avoid socket.lua duplicating the iteration over the results
of getaddrinfo(). Some problems with the C implementation not
initializing sockets or the luasocket family have also been fixed,
and error reporting made more robust.
2012-05-10 14:14:22 -07:00
0c3e067af1 Add a getnameinfo() wrapper
This wrapper takes a domain name or an IP as first argument
and a service name or port as second argument.
Either argument may be nil.

It returns a list of names (always only one in the IP case) and a
service name.
2012-05-05 02:13:56 +02:00
c2e29537f5 Fixed getpeername/getsockname situation
- Added IPv6 support to getsockname
- Simplified getpeername implementation
- Added family to return of getsockname and getpeername
and added modification to the manual to describe
2012-04-24 00:47:30 +08:00
f960b3872a Making progress toward a release
Documented headers.lua
Update copyright date everywhere
Remove RCSID from files
Move version back to 2.1 rather than 2.1.1
Fixed url package to support ipv6 hosts
Changed "domain" to "family" in tcp and udp structures
Implemented getfamily methods
2012-04-23 00:18:45 +08:00
f399ab25fc inet: Honor the strict aliasing rule 2012-04-11 13:33:35 -07:00
e15ed19db6 Compiles with Lua 5.1.4 and Lua 5.2.0-beta, although the makefile needs sorting out to take maybe a version number and also the local paths need removing. 2012-04-11 13:33:34 -07:00
a984607f28 inet: return more useful errors 2012-04-11 13:33:34 -07:00
7893d9ece2 inet: refactor getpeername to allocate the struct on the stack 2012-04-11 13:33:34 -07:00
8393c76180 Fix getpeername to work with IPv6 addresses 2012-04-11 13:33:34 -07:00
594f826aa1 Add support for connecting to IPv6 hosts 2012-04-11 13:33:34 -07:00
5874d47f55 dns.getaddrinfo: Return proper error messages 2012-04-11 13:33:34 -07:00
5065a2585c dns: Rename toip6() to getaddrinfo() since the old name is misleading 2012-04-11 13:33:34 -07:00
923eef1929 Rework binding IPv6 sockets by harmonizing it with the IPv4 variant 2012-04-11 13:33:34 -07:00
2778766d67 Preliminary IPv6 support for v2.1 2012-04-11 13:25:11 -07:00
3a8ba90dfb Saving before big changes to support IPv6. 2011-05-25 20:57:22 +00:00
f4dadea763 Before compiling on Windows. 2005-10-07 04:40:59 +00:00
a32c6d9140 Almost ready to release. 2005-09-29 06:11:42 +00:00
65c35845c5 Working on the manual. 2005-06-14 04:29:23 +00:00
8d4e240f6a Forward server working on Mac OS X... 2005-02-08 10:01:01 +00:00
e4e2223cff Fixed a bunch of stuff. Added mike's patches. 2004-07-16 06:48:48 +00:00
9a79d500eb Still need to fix windows. :o/ 2004-07-15 06:11:53 +00:00
58096449c6 Manual is almost done. HTTP is missing.
Implemented new distribution scheme.
Select is now purely C.
HTTP reimplemented seems faster dunno why.
LTN12 functions that coroutines fail gracefully.
2004-06-15 06:24:00 +00:00
9ed7f955e5 Só pra não perder se der merda. 2004-06-04 15:15:45 +00:00
e77f179200 Adjusted some of the broken examples. 2004-03-26 00:18:41 +00:00
0b2542d1a6 Worked on the manual.
Implemented stuffing (needs test)
Added cddb and qp examples.
2004-02-04 14:29:11 +00:00