mirror of
				https://github.com/lunarmodules/luasocket.git
				synced 2025-10-31 10:25:55 +01:00 
			
		
		
		
	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".
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef INET_H 
 | |
| #define INET_H 
 | |
| /*=========================================================================*\
 | |
| * Internet domain functions
 | |
| * LuaSocket toolkit
 | |
| *
 | |
| * This module implements the creation and connection of internet domain
 | |
| * sockets, on top of the socket.h interface, and the interface of with the
 | |
| * resolver. 
 | |
| *
 | |
| * The function inet_aton is provided for the platforms where it is not
 | |
| * available. The module also implements the interface of the internet
 | |
| * getpeername and getsockname functions as seen by Lua programs.
 | |
| *
 | |
| * The Lua functions toip and tohostname are also implemented here.
 | |
| \*=========================================================================*/
 | |
| #include "lua.h"
 | |
| #include "socket.h"
 | |
| #include "timeout.h"
 | |
| 
 | |
| #ifdef _WIN32
 | |
| #define INET_ATON
 | |
| #endif
 | |
| 
 | |
| int inet_open(lua_State *L);
 | |
| 
 | |
| const char *inet_trycreate(p_socket ps, int family, int type);
 | |
| const char *inet_tryconnect(p_socket ps, const char *address,
 | |
|         const char *serv, p_timeout tm, struct addrinfo *connecthints);
 | |
| const char *inet_trybind(p_socket ps, const char *address, const char *serv,
 | |
|         struct addrinfo *bindhints);
 | |
| const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm);
 | |
| 
 | |
| int inet_meth_getpeername(lua_State *L, p_socket ps, int family);
 | |
| int inet_meth_getsockname(lua_State *L, p_socket ps, int family);
 | |
| 
 | |
| int inet_optfamily(lua_State* L, int narg, const char* def);
 | |
| int inet_optsocktype(lua_State* L, int narg, const char* def);
 | |
| 
 | |
| #ifdef INET_ATON
 | |
| int inet_aton(const char *cp, struct in_addr *inp);
 | |
| #endif
 | |
| 
 | |
| #endif /* INET_H */
 |