def self.accept_loop
# File mrbgems/mruby-socket/mrblib/socket.rb, line 360 def self.getaddrinfo(nodename, servname, family=nil, socktype=nil, protocol=nil, flags=0) Addrinfo.getaddrinfo(nodename, servname, family, socktype, protocol, flags).map { |ai| ary = ai._to_array ary[2] = nodename ary[4] = ai.afamily ary[5] = ai.socktype ary[6] = ai.protocol ary } end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 354 def initialize(domain, type, protocol=0) super(Socket._socket(domain, type, protocol), "r+") end
def self.getnameinfo def self.ip_address_list
# File mrbgems/mruby-socket/mrblib/socket.rb, line 374 def self.open(*args) new(args) end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 378 def self.sockaddr_in(port, host) ai = Addrinfo.getaddrinfo(host, port, nil, Socket::SOCK_DGRAM)[0] ai.to_sockaddr end
def self.tcp def self.tcp_server_loop def self.tcp_server_sockets def self.udp_server_loop def self.udp_server_loop_on def self.udp_server_recv def self.udp_server_sockets def self.unix(path) def self.unix_server_loop def self.unix_server_socket
# File mrbgems/mruby-socket/mrblib/socket.rb, line 394 def self.unpack_sockaddr_in(sa) Addrinfo.new(sa).ip_unpack.reverse end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 408 def accept fd, addr = self.sysaccept [ Socket.for_fd(fd), addr ] end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 413 def accept_nonblock begin self._setnonblock(true) self.accept ensure self._setnonblock(false) end end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 422 def bind(sockaddr) sockaddr = sockaddr.to_sockaddr if sockaddr.is_a? Addrinfo Socket._bind(self.fileno, sockaddr) 0 end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 428 def connect(sockaddr) sockaddr = sockaddr.to_sockaddr if sockaddr.is_a? Addrinfo Socket._connect(self.fileno, sockaddr) 0 end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 434 def connect_nonblock(sockaddr) begin self._setnonblock(true) self.connect(sockaddr) ensure self._setnonblock(false) end end
def ipv6only!
# File mrbgems/mruby-socket/mrblib/socket.rb, line 445 def listen(backlog) Socket._listen(self.fileno, backlog) 0 end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 450 def recvfrom(maxlen, flags=0) msg, sa = _recvfrom(maxlen, flags) socktype = self.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE).int [ msg, Addrinfo.new(sa, Socket::PF_UNSPEC, socktype) ] end