<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.fr.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>20 Feb 2020 12:11:41 Z</lastBuildDate><pubDate>19 Feb 2020 10:31:27 Z</pubDate><description>Bonjour,&#13;
&#13;
pour un client je dois utiliser des sockets.&#13;
&#13;
J'ai un bouton qui me permets de créer un socket + thread:&#13;
&#13;
[code:wl]&#13;
SI ThreadEtat("THREAD_Event") &lt;&gt; threadInexistant ALORS&#13;
	ThreadArrête("THREAD_Event")&#13;
FIN&#13;
&#13;
SI SocketExiste("Serveur") ALORS&#13;
	SocketFerme("Serveur")&#13;
FIN&#13;
&#13;
SocketCrée("Serveur",55561,"192.168.0.1")&#13;
&#13;
ThreadExécute("THREAD_Event",threadNormal,THREAD_Event)&#13;
[/code]&#13;
&#13;
La procédure THREAD_Event réalise une boucle :&#13;
&#13;
[code:wl]&#13;
BOUCLE&#13;
		SI SocketAttendConnexion("Serveur") = Vrai ALORS&#13;
			Trace("Socketconnect OK")&#13;
			sCanal = SocketAccepte("Serveur")&#13;
			&#13;
			SocketChangeModeTransmission(sCanal,SocketMarqueurFinBuffer,Caract(Null))&#13;
			&#13;
			BOUCLE&#13;
				m++&#13;
				Trace("Boucle XML : "+m)	&#13;
				//Récupère le message&#13;
				sXMLTemp = SocketLit(sCanal,Vrai)&#13;
				&#13;
				SI sXMLTemp &lt;&gt; "" ALORS&#13;
					Event.XML = sXMLTemp&#13;
					HAjoute(Event)&#13;
					&#13;
					AnalyseXML(sXMLTemp)&#13;
					&#13;
					sXMLTemp = ""&#13;
				FIN						&#13;
				&#13;
			FIN&#13;
		FIN&#13;
		&#13;
FIN&#13;
[/code]&#13;
&#13;
En Go dans Windev ca marche au premier lancement.&#13;
J'ai un autre bouton pour fermer le socket et tuer le thread.&#13;
Si je reclique sur mon bouton initial qui crée le thread et le socket alors ca ne fonctionne plus.&#13;
Il semblerait que SocketAttendConnexion soit toujours faux.&#13;
&#13;
Pour que ca refonctionne je dois stopper mon test dans Windev puis relancer en Go.&#13;
Auriez-vous une idée de pourquoi ca marche au premier coup mais plus ensuite ?&#13;
&#13;
Merci</description><ttl>30</ttl><generator>WEBDEV</generator><language>fr_FR</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread/read.awp</link><title>Socket et Thread</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>nicolas.cabrie</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237170/read.awp</comments><pubDate>20 Feb 2020 12:11:41 Z</pubDate><description>Bonjour,&#13;
&#13;
merci pour ce retour, j'ai appliqué tes conseils mais cela ne solutionne pas mon problème.&#13;
Apres arret, la re créat…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237170/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237170/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread/read.awp">Socket et Thread</source><title>Re: Socket et Thread</title></item><item><author>BAILLINDUSTRIE</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237149/read.awp</comments><pubDate>19 Feb 2020 15:21:00 Z</pubDate><description>Bonjour,&#13;
&#13;
Déjà évite les boucles sans sortie.&#13;
Met un time out sur ton SocketAttendConnexion&#13;
Pour arrêter ton thread, ajoute …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237149/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread-237149/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/237134-socket-thread/read.awp">Socket et Thread</source><title>Re: Socket et Thread</title></item></channel></rss>
