Commit Graph

79 Commits

Author SHA1 Message Date
Leso_KN
f741a88b80
feat(tcp): Add 'bindtodevice' option (#408) 2023-10-23 21:27:01 +03:00
Kim Alvefur
d1ad8160cb
feat(tcp): Add support for TCP Defer Accept
This makes it so that a listening socket does not become readable for
accept() until a connection has been fully established *and* started
sending something, thus the program doesn't have to wait for the first
data. This only makes sense for client-speaks-first protocols.

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2022-07-27 09:40:18 +03:00
Kim Alvefur
0c7df119c2
feat(tcp): Add support for TCP Fast Open 2022-07-27 09:16:43 +03:00
E. Westbrook
86e1b3f45f tcp: pragma visibility 2019-03-10 00:04:20 -07:00
E. Westbrook
525d703e16 tcp.c: use LUASOCKET_PRIVATE 2019-02-25 16:00:51 -07:00
Diego Nehab
a9c75cb099
Merge pull request #244 from leyyer/options
add options:
2019-02-24 17:57:23 -03:00
Diego Nehab
699c36c019
Merge pull request #116 from linuxmaniac/master
Add "tcp-keepidle", "tcp-keepcnt" and "tcp-keepintvl" options
2019-02-24 17:55:27 -03:00
surenyi
97bfe1e043 add options:
get/set : recv-buffer-size
get/set : send-buffer-size

Signed-off-by: surenyi <surenyi82@163.com>
2018-03-25 14:58:10 +08:00
Diego Nehab
944305dc21 Added gettimeout for completeness.
Also documented.
Rordered manuals so order is alphabetical.
2016-03-04 15:36:32 -03:00
Diego Nehab
83880dbed7 When zero-timeout, only try first address in connect. 2015-12-03 12:56:18 -02:00
Diego Nehab
f4b4720073 Merge branch 'tcp_reuseport' of https://github.com/KateAdams/luasocket into KateAdams-tcp_reuseport 2015-10-05 10:28:29 +08:00
Diego Nehab
77bba625d7 Fixes suggested by @Florob in #147. 2015-08-25 15:41:40 -03:00
Diego Nehab
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
Diego Nehab
e75444ccd1 New compat.h module implements luaL_setfuncs.
Makes initialization code simpler everywhere.
2015-08-21 15:39:34 -03:00
Victor Seva
2906d6a522 Add "tcp-keepidle", "tcp-keepcnt" and "tcp-keepintvl" options 2014-12-05 13:17:50 +01:00
kobra
833333e131 Added ability to set the option reuseport of a tcp socket. 2013-09-12 00:46:32 +01:00
moteus
1de617e355 Add. Allow get error option to socket. 2013-05-29 14:33:27 +04:00
Diego Nehab
79e6c4915d Export global only if LUA_COMPAT_MODULE defined. 2013-05-29 16:56:56 +08:00
moteus
e54f78c61c Fix. setsockname fails with "*" as host.
Add. test_bind.lua
2013-05-27 11:25:31 +04:00
Diego Nehab
427220c7b1 Merge tryconnect6 into inet_tryconnect. 2013-05-26 21:26:26 +08:00
Diego Nehab
6d93fd7c8f Fix socket.connect
Previous implementation was not making sure the socket
had the same family as the addr returned by getaddrinfo.
So instead of "connection refused", we could get "invalid
argument", which was our fault.
2013-05-26 15:18:13 +08:00
Diego Nehab
72a5347f97 Remove warnings and fix makefile for Win32. 2012-12-11 17:43:49 -02:00
Diego Nehab
618ce43ee3 Fix socket_accept usage to depend on family. 2012-12-11 16:35:27 -02:00
Diego Nehab
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
Paul Aurich
d777341eaf tcp: Initialize clnt->family in :accept()
Also unconditionally zero out the structs when allocated, for
good measure.
2012-05-21 19:44:08 -07:00
Sam Roberts
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
Sam Roberts
e86eac96fa :shutdown() errors on all invalid argument strings
It used to error only on invalid argument strings that started with 's',
'r', or 'b'.
2012-04-26 16:50:27 -07:00
Diego Nehab
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
Diego Nehab
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
Sam Roberts
4b671f4551 Merge branch 'git-sam' into diego-sam-mwild-integration
Conflicts in options.c were just due to independent small functions
being close to each other.

unix.c in mwild was broken, it wasn't using LUASOCKET_API.

serial.c needed luaL_reg renamed, and to use LUASOCKET_API.

makefile didn't respect standard DESTDIR and prefix makefile
variables, and didn't allow LUAV variable to select lua version to build
against.

I've tested the top-level install-both target builds and installs
against both lua5.1 and lua5.2, but not done further testing.

Conflicts:
	README
	config
	gem/ltn012.tex
	makefile
	src/makefile
	src/options.c
	src/options.h
	src/tcp.c
	src/usocket.c
2012-04-11 14:18:20 -07:00
Sam Roberts
8bb542baaf Support getoption method for tcp objects. 2012-04-11 13:54:01 -07:00
Liam Devine
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
Florian Zeitz
594f826aa1 Add support for connecting to IPv6 hosts 2012-04-11 13:33:34 -07:00
Florian Zeitz
f871a29f27 Add support for the IPV6_V6ONLY socket option defaulting to on. 2012-04-11 13:33:34 -07:00
Florian Zeitz
923eef1929 Rework binding IPv6 sockets by harmonizing it with the IPv4 variant 2012-04-11 13:33:34 -07:00
Paul Aurich
908ee2cce1 Fix two crashes and add -Wshadow so that this can't happen again.
The two crashes are the s/const char *// changes in tcp.c.  The rest
is cleanup so it will build.
2012-04-11 13:33:34 -07:00
Diego Nehab
2778766d67 Preliminary IPv6 support for v2.1 2012-04-11 13:25:11 -07:00
Diego Nehab
bce60be30f Decent makefiles! 2009-05-27 09:31:38 +00:00
Diego Nehab
f4dadea763 Before compiling on Windows. 2005-10-07 04:40:59 +00:00
Diego Nehab
a32c6d9140 Almost ready to release. 2005-09-29 06:11:42 +00:00
Diego Nehab
9596c7f95d Bug in forward.lua. Wasn't breaking from the loop. 2005-04-21 05:38:07 +00:00
Diego Nehab
434e8e014c Better connection handling. 2005-04-21 03:15:34 +00:00
Diego Nehab
2a00a5ad50 Trying to get non-blocking connect to work. 2005-04-20 18:57:47 +00:00
Diego Nehab
6dc9c1096a Seems to be working on windows. 2005-03-11 02:21:27 +00:00
Diego Nehab
e57f9e9964 Apparently, non-blocking connect doesn't work on windows if you use 0
timeout in the select call...
2005-03-11 00:20:21 +00:00
Diego Nehab
7350bad6f4 Just to check out in the office. 2005-02-27 18:30:32 +00:00
Diego Nehab
8d4e240f6a Forward server working on Mac OS X... 2005-02-08 10:01:01 +00:00
Diego Nehab
2cd2a5d4a4 Stupid bug. 2005-01-22 22:38:43 +00:00
Diego Nehab
7c97e8e40a Almost ready for beta3 2004-11-27 07:58:04 +00:00
Diego Nehab
cd994f306a Gonna try my luck on windows... 2004-07-26 04:03:55 +00:00