class SCTPStreamServer

Defined in:

sctp/variants/sctp_stream_server.cr

Constructors

Instance Method Summary

Instance methods inherited from class SCTPBaseSocket

address(host, port, family = Socket::Family::INET6) address, addressv4(host, port) addressv4, addressv6(host, port) addressv6, autoclose=(seconds : Int32 | Nil) autoclose=, bind(host, port, type : Socket::Type, dns_timeout = nil, &) bind, listen(backlog = 128) listen, on_message(stream_no : UInt16 | Int32, source : IPAddress, &callback : SCTPMessage -> )
on_message(source : IPAddress, &callback : SCTPMessage -> )
on_message(stream_no : UInt16 | Int32, &callback : SCTPMessage -> )
on_message(&on_message : SCTPMessage -> )
on_message(stream_no : UInt16 | Int32, source : IPAddress, none : Nil)
on_message(source : IPAddress, none : Nil)
on_message(stream_no : UInt16 | Int32, none : Nil)
on_message
, process process, receive(slice : Slice(UInt8)) : Tuple(Int32, UInt16, IPAddress)
receive : SCTPMessage
receive
, send(slice : Slice(UInt8), stream_no : UInt16, to : IPAddress) : Int32
send(data, stream_no : Int32 | UInt16, to : IPAddress) : Int32
send
, set_socketopt(option : Int32, value) set_socketopt

Constructor methods inherited from class SCTPBaseSocket

new(family : Socket::Family, type : Socket::Type)
new(fd : Int32, type : Socket::Type)
new

Constructor Detail

def self.new(port : Int, backlog = 128) #

[View source]
def self.new(host, port, backlog = 128) #

[View source]

Instance Method Detail

def accept(&) #

[View source]
def accept : SCTPStreamSocket #
Description copied from class Socket

Accepts an incoming connection.

Returns the client socket. Raises an IO::Error (closed stream) exception if the server is closed after invoking this method.

require "socket"

server = TCPServer.new(2202)
socket = server.accept
socket.puts Time.utc
socket.close

[View source]
def accept?(&) #

[View source]
def accept? : SCTPStreamSocket | Nil #
Description copied from class Socket

Accepts an incoming connection.

Returns the client Socket or nil if the server is closed after invoking this method.

require "socket"

server = TCPServer.new(2202)
if socket = server.accept?
  socket.puts Time.utc
  socket.close
end

[View source]