socket programming



Hi

I am newbi in socket programming. I am learning it
with SWI for the simplicity and quick results.
I tried some socket SWI's socket predicates,
during that I met a problem.

I opened two seperate prolog tasks.
Following small codes shows what I wrote in
each task stepwise.
*Note*: 'advait' is my hostname i.e. my compueter itself

%%%%%%%%%%%%% Task 1 %%%%%%%%%%%%%%%%%%%%%%%%%

?- tcp_socket(Sock),tcp_bind(Sock,P). %% Step 1

Sock = '$socket'(252)
P = 1032


?- tcp_socket(Sk),tcp_connect(Sk, raut:1033). %% step 3

ERROR: Socket error: Connection refused
Exception: (17) socket:tcp_connect('$socket'(256), advait:1033) ?
creep


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%% Task 2 %%%%%%%%%%%%%%%%%%%%%

?- tcp_socket(Sock),tcp_bind(Sock,P). %% Step 2

Sock = '$socket'(252)
P = 1033


?- tcp_socket(Sk),tcp_connect(Sk, advait:1032). %% Step 4 immediately
%% after step 3

ERROR: Socket error: Connection refused
Exception: (8) socket:tcp_connect('$socket'(256), advait:1032) ?
creep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Why did I get these errors in each of the tasks?
Please, Can anyone help me ?

yours
Advait

.



Relevant Pages

  • [PATCH] Delete superfluous source file "net/wanrouter/af_wanpipe.c".
    ... 2000 Nenad Corbic o Fixed the corrupt sock lcn problem. ... -/* SECURE SOCKET IMPLEMENTATION ... * routine in the wanpipe driver. ... -static void * dbg_kmalloc(unsigned int size, int prio, int line) { ...
    (Linux-Kernel)
  • [PATCH 1/6] x25: Allow 32 bit socket ioctl in 64 bit kernel
    ... The following patch provides 32 bit userland ioctl support for modular ... socket ioctls in a 64 bit kernel. ... SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \ ... SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, ...
    (Linux-Kernel)
  • Re: passing this object
    ... Sock which extends CSocketComm. ... Once the socket class processed the data, ... reference of CVirtualScreen - screen.setMessage function ...
    (microsoft.public.vc.language)
  • Re: freeing port - winsock
    ... When I create and destroy many sockets without specifying the local port to bind, It seems that this local port is not free after using the function closesocket. ... It's goal is to create a socket, connect to a remote server on port 80, close the socket and to loop on these actions. ... int host ... SOCKET sock = INVALID_SOCKET; ...
    (comp.programming)
  • Re: passing this object
    ... Sock which extends CSocketComm. ... Once the socket class processed the data, ... reference of CVirtualScreen - screen.setMessage function ...
    (microsoft.public.vc.language)