Skip to content

opening a new server socket #2219

Answered by bakaq
razetime asked this question in Q&A
Discussion options

You must be logged in to vote

The SeverSocket is to be used in socket_server_accept/4 to get an actual stream that you can use to get and send data. It is also used in socket_server_close/1 to close a socket. For example:

?- socket_server_open('127.0.0.1':8001, ServerSocket), socket_server_accept(ServerSocket, Client, Stream, []).
   % This will wait here until a connection to the server is made. I acessed the address
   % and port in my browser, and then the variables Client and Stream are instantiated as
   % follows:
   ServerSocket = , Client = '127.0.0.1:59292', Stream = '$stream'(0x55f49f47e498).

In the second query you are making with format/2, the reason there is an instantiation error is because the variables A…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by razetime
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants