tcp functions
is there a module for tcp functions or any other quick way to connect, listen, send and recieve from tcp? thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
tcp
i have this small script which after some router configurations works. ## #! /usr/bin/python import socket HOST = '' PORT = 1515 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() conn.send('HTTP/1.1 200 OK\r\n') conn.send('Content-Type: text/html\r\n') conn.send('Server: test/1.0\r\n\r\n') conn.send('test') s.close() ## as you see it listens to 1515 until a connection is established and then it accepts it... the problem is that when it accepts the connection it sends those strings and exits, but then it exits the program. i want it to listen to 1515 then accept a connection, send.. and then listen to the port again and again until new connections are found. i've been struggling with try..except,while and all kinds of loops but always new erros pop up, or it overflows. -- http://mail.python.org/mailman/listinfo/python-list
Re: tcp
you could at least check before posting. as i said i've tried like 1000 ways of doing that, and im so desparate that i'm thinking of quiting python. This damn thing just doesnt work. when i do as you post the server never even replies, as it tends to accept connections all the time. anyone has a better idea? -- http://mail.python.org/mailman/listinfo/python-list
Re: tcp
sorry for acting like a fool but this is just to weirdly easy that i can't get to work. i've written a small web server in another language and this is more like copying code. i already have everything figured out, except this one but noone seems either willing or capable of helping me. again sorry but i was in a very bad mood. -- http://mail.python.org/mailman/listinfo/python-list
Re: tcp
i would like to apologize once more. i understand that you are saying "what a fool he is waiting for us to solve all his problems", cause i've said that for other posts, when they seemed "immature". It's just that i couldn't find a way out of 20 lines of code and this drove me mad. i end this topic here. -- http://mail.python.org/mailman/listinfo/python-list
Re: tcp
thanks everybody, i've got this to work. i'm not trying to write an actual web server, i'm just using it for some procedures like URL rewriting. -- http://mail.python.org/mailman/listinfo/python-list
execute
i'm trying to execute a file without replacing the current process, but after searching the help file, documentations and the web, i can't a way of doing that. os.exec*() will close the current program. ps: by executing i mean like typing "mspaint" in run dialog.. it's not a python file -- http://mail.python.org/mailman/listinfo/python-list
Re: execute
i know os.popen() but i want to execute a file with args -- http://mail.python.org/mailman/listinfo/python-list
Re: execute
ok i found a workaround. -- http://mail.python.org/mailman/listinfo/python-list
wxPython listctrl
I was wondering if there is a way to extract an icon from a file (executable) and then add it in a listctrl. I also 'd like to know if i can shorten the icon in order to fit in a listctrl item. I've managed to get the icon from an icon file and add t as a listctrl item but it remains 32x32. code: images = ['LimeWire.ico'] self.il = wx.ImageList(18, 10) self.il.Add(wx.Bitmap(images[0])) #This below raises an error saying that no handle was found for that image #self.ib = wx.IconBundle() #self.ib.AddIconFromFile(r'LimeWire.exe', wx.BITMAP_TYPE_ANY) self.listView1.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.listView1.SetItemImage(0, 0) -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython listctrl
thanks Mike, i'll post there. -- http://mail.python.org/mailman/listinfo/python-list