473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

connexion client serveur python

5
Bonjour,

Voilà, j'ai débuté recemment avec python et je veux faire une connexion client serveur (windows) par l'intermédiaire d'une interface QT Designer v 4. j'ai choisi ERIC v 4 comme IDE.

l'interface QT contient 2 champs Edittext(recep , emmision) l'un est réservé aux messages emis par le client et l'autre pour les messages renvoyés par le serveur; et un bouton connexion(conec).

le probléme, c'est qu'il y a eu une "petite" connexion entre l'interface et le serveur (sous Dos) mais le programme génère plusieurs erreurs (puis il se bloque) et il n'y a pas de synchronisation entre les messages client serveur.
SVP, pouvez vous m'aider.

le code :

Code :
.....
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
QtCore.QObject.connect(self.conec,QtCore.SIGNAL("c licked()"),self.so)

def so(self):
mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
mySocket.connect(( self.adressec.text() , int(self.numport.text())))
except socket.error:
self.emmision.setText("La connexion a echoue.")
sys.exit()
self.emmision.setText("Connexion etablie avec le serveur.")
msgServer= mySocket.recv(1024)
while 1:
if msgServer.upper() == "FIN" or msgServer=="":
break
self.recep.setText(msgServer)
a=self.emmision.text()
mySocket.send(a)
self.recep.setText(msgServer)
msgServer= mySocket.recv(1024)
print "Connexion interrompue."

mySocket.close()
.......Merci.
Mar 3 '08 #1
0 1431

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: cyril | last post by:
Bonjour à tous, j'utilise Apache php et mysql sans probleme, j'ai voulu passer pour des raisons pro sur IIS PHP MS SQL.IIS et PHP fonctionne bien, j ai decommenté la ligne pour ms sql, copier la...
3
by: José | last post by:
I have a farm with 4 web servers. I want to write a client-server program to rotate logs. Basically the server has only one file, if I run it, the server listens. The client has 2 files, one...
2
by: elsC | last post by:
Bonjour, Je viens d'installer SQL Server 2000 Dev edition. J'ai créé des connexions sécurisées SQL Server et pourtant lorsque j'essaie de me connecter avec PHP (mssql_connect('localhost',...
2
by: nazgulero | last post by:
Hello all, I am fairly new to C++, and I am trying to write a client/server API for multicast. I have come across the script below, but for some reason, the server does not get any of the...
5
by: Chris | last post by:
Bonjour, Plusieurs fichiers PHP d'un programme open source de compteur de visites viennent de se faire hacker sur mon serveur (hébergement mutualisé chez un fournisseur d'accès). Le hacker a...
0
by: ThomasB | last post by:
hello all, and first sorry for my bad english. I'm trying to implement a way to enable unique connexion for user to a web site with VWExpress, dotnet 2. I use profile to store user...
2
by: Serge Fournier | last post by:
Hello everyone. How to give the connexion information to a crystal report at run time ? same question concerning the SQL string for data extraction ? Is it "a must" to disconnect the report at...
8
by: Djim | last post by:
Hello, i am starting PHP, and after 2 days of search, i am posting. MY PURPOSE : opening a XLS files (in MS Excel) on the client side, the user can update anything, then it will be automaticly...
0
by: eliseo | last post by:
Hello, I want to make the same application : python Serveur and J2me Client whit ssl socket. I would like to know if you have solved the problem? Can you show me the final version of python...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.