clj-sockets.core

Contains all of the functions that make up the public API of this project.

close-socket

(close-socket socket)
Close the socket, and also closes its input and output streams.

create-server

(create-server port)
Initialise a ServerSocket on localhost using a port.

Passing in 0 for the port will automatically assign a port based on what's
available.

create-socket

(create-socket hostname port)
Connect a socket to a remote host. The call blocks until
the socket is connected.

listen

(listen server-socket)
Waits for a connection from another socket to come through, then
returns the server's now-connected Socket.

read-char

(read-char socket)
Read a single character from a socket.

read-line

(read-line socket)
Read a line from the given socket

read-lines

(read-lines socket)
Read all the lines currently loaded into the input stream of a socket.

write-line

(write-line socket message)
Send a line over the socket.

write-to

(write-to socket message)
Send a string over the socket.