need help with recieving sockets

A

Andrew

Hi I was wondering if any one could help me with a chat client I am
writing my main issue is not in the sending of messages or in the
connection setting.

I am having issues receiving the messages. I am using Tkinter as the GUI
and Python 2.3.5

my code has been edited so many times but no matter what I do everytime
I click my recieve button the client crashes and Tkinter freezes up and
I don't recieve the message back from the server.

Does anyone have any ideas what I am doing wrong

here is the latest function I am using:


def recv_basic():
textbox.insert(END, sock.recv(1024))
textbox.insert(END, "\n\n")

on a side note I can get the first connection message back from the
server if I click the recieve button. Another side note I have tried two
different servers one I wrote and another one I found in a tutorial

Cheers and thanks for any help
 
P

Peter Hansen

Andrew said:
Hi I was wondering if any one could help me with a chat client I am
writing my main issue is not in the sending of messages or in the
connection setting.

Your main issues should probably include those things and more. Judging
by the simplistic way you are attempting to get this to work, you
probably haven't read the following tutorial (see link below).

I strongly recommend you read that, and then _don't_ reinvent the wheel
but instead learn to use an existing package that hides many of these
mundane and difficult-to-get-right details from you.

The "asyncore" package in the standard library or Twisted are two
approaches, or you could learn about SocketServer and others also in the
standard library and use them instead.

http://www.amk.ca/python/howto/sockets/


-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top