[Click] Click Socket Problem

Lizhao You youlizhao.nju at gmail.com
Tue May 19 02:56:28 EDT 2009


Hi all,

I am a newbie with Click, and want some help of socket usage in click. I
search google with keyword: click socket, and cannot find the answer to my
question, so please forgive me if there exists discussion about my problem
in archives.

I want to establish socket connection in localhost processes. The click side
is a server, and i want click to print the packet received from socket. I
also write a socket client in a python file.

The python side code(client.py) is:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('8001')
sock.send('1')

The click side code is:
Socket(UNIX, '8001') -> Print(ok) -> Discard;
(The reason why i donot use FromSocket is that i get a warning: FromSocket
is deprecated, use Socket instead)

I guess the click side code pose a connection in port 8001. Python side
connect to 8001, then send packet. But when i python client.py, the bash
says: socket.error: (111, 'Connection refused') . The connection cannot be
established, so i guess something must be wrong with Socket(UNIX, '8001').
So can someone tell me how to set up a socket connetion and print the packet
from socket? Or something about how to use Socket()? My click was downloaded
last week, so it maybe the latest.

Anything in this regard is highly appreciated! Thank you very much!

thanks,
Lizhao

-- 
Lizhao You
Undergraduate Student of GPS Group
Department of Computer Science and Technology, Nanjing University
Nanjing, Jiangsu, 210093 China PR.


More information about the click mailing list