poisonkiller Posted May 23, 2007 Share Posted May 23, 2007 (edited) I tested both server and client, they are working fine for me. Also, I made clients GUI reappear if you dont want to send more messages to server.Server.au3Client.au3 Edited May 23, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
PcExpert Posted May 23, 2007 Author Share Posted May 23, 2007 I'm going crazy. This doesn't work either. I think I stay by the Inputbox. Because I don't think this is gonna work. I still think that its very strange that the inputbox works fine and the buttons/radiobuttons don't. Link to comment Share on other sites More sharing options...
PcExpert Posted May 23, 2007 Author Share Posted May 23, 2007 Can somebody please explain why the service (TCPRecv) sometimes does not accept connections and exits with WSA ERROR 10050 or WAS ERROR 10061. My Service code: expandcollapse popup;SERVER!! Start Me First !!!!!!!!!!!!!!! #NoTrayIcon Opt("TrayMenuMode",1) Dim $szIPADDRESS = @IPAddress1, $nPORT = 33891, $ConnectedSocket = -1, $MainSocket, $msg, $recv, $szIP_Accepted ; Start The TCP Services ;============================================== TCPStartUp() ; Create a GUI for messages ;Wait for connection and convert socket into IP Listen() ; GUI Message Loop ;============================================== ; Try to receive (up to) 2048 bytes ;---------------------------------------------------------------- While 1 $recv = TCPRecv( $ConnectedSocket, 2048 ) ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop ; Update the edit control with what we have received ;---------------------------------------------------------------- Select Case $recv = "ENDING_BYE" TCPCloseSocket($ConnectedSocket) TCPCloseSocket($MainSocket) Listen() Case $recv = "#shutdown" shutdown(1) Case $recv = "#reboot" shutdown(2) Case $recv = "#blocky" BlockInput(1) Case $recv = "#blockn" BlockInput(0) Case $recv <> "" TraySetState(5) SoundPlay(@WindowsDir & "\media\notify.wav",0) TrayTip("Bericht van " & $szIP_Accepted, $recv, "", 1) Sleep(7000) TraySetState(10) EndSelect WEnd If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutDown() ; Function to return IP Address from a connected socket. ;---------------------------------------------------------------------- Func SocketToIP($SHOCKET) Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]") Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _ "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc Func Listen() ; Create a Listening "SOCKET". ; Using your IP Address and Port 33891. ;============================================== $MainSocket = TCPListen($szIPADDRESS, $nPORT) ; If the Socket creation fails, exit. If $MainSocket = -1 Then Exit ;Wait for and Accept a connection ;============================================== Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 ; Get IP of client connecting Dim $szIP_Accepted = SocketToIP($ConnectedSocket) EndFunc Thanks! Link to comment Share on other sites More sharing options...
PcExpert Posted May 25, 2007 Author Share Posted May 25, 2007 (edited) It's pretty weird, but now it running for some days and always after 30 minutes of running fine the service just doesn't accept connections anymore. Pretty strange isnt it? This is the current code: expandcollapse popup;SERVER!! Start Me First !!!!!!!!!!!!!!! #NoTrayIcon Opt("TrayMenuMode",1) Dim $szIPADDRESS = @IPAddress1, $nPORT = 33891, $ConnectedSocket = -1, $MainSocket, $msg, $recv, $szIP_Accepted ; Start The TCP Services ;============================================== TCPStartUp() ; Create a GUI for messages ;Wait for connection and convert socket into IP Listen() ; GUI Message Loop ;============================================== ; Try to receive (up to) 2048 bytes ;---------------------------------------------------------------- While 1 $recv = TCPRecv( $ConnectedSocket, 2048 ) ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop ; Update the edit control with what we have received ;---------------------------------------------------------------- Select Case $recv = "ENDING_BYE" TCPCloseSocket($ConnectedSocket) TCPCloseSocket($MainSocket) Listen() Case $recv = "#shutdown" shutdown(1) Case $recv = "#reboot" shutdown(2) Case $recv = "#blocky" BlockInput(1) Case $recv = "#blockn" BlockInput(0) Case $recv <> "" TraySetState(5) If $szIP_Accepted = "192.168.0.102" Then $szIP_Accepted = "HP" ElseIf $szIP_Accepted = "192.168.0.101" Then $szIP_Accepted = "AOPEN" ElseIf $szIP_Accepted = "192.168.0.100" Then $szIP_Accepted = "SERVER" ElseIf $szIP_Accepted = "192.168.0.103" Then $szIP_Accepted = "ACER" EndIf SoundPlay(@WindowsDir & "\media\notify.wav",0) TrayTip("Bericht van " & $szIP_Accepted, $recv, "", 1) Sleep(7000) TraySetState(10) EndSelect WEnd If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutDown() ; Function to return IP Address from a connected socket. ;---------------------------------------------------------------------- Func SocketToIP($SHOCKET) Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]") Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _ "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc Func Listen() ; Create a Listening "SOCKET". ; Using your IP Address and Port 33891. ;============================================== $MainSocket = TCPListen($szIPADDRESS, $nPORT) ; If the Socket creation fails, exit. If $MainSocket = -1 Then Exit ;Wait for and Accept a connection ;============================================== Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 ; Get IP of client connecting Dim $szIP_Accepted = SocketToIP($ConnectedSocket) EndFunc Do I have to start from scratch with the TCPRecv example and then do it all over again, or is there a simple solution for this problem? Edited May 26, 2007 by PcExpert Link to comment Share on other sites More sharing options...
PcExpert Posted May 28, 2007 Author Share Posted May 28, 2007 I just did a complete rebuild of the program. Now it works fine, even for days. So I thought it would be nice to have a program for the settings of the client. This is the code: expandcollapse popup#include <GUIConstants.au3> $main = GUICreate("Chat Settings", 250, 200) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Play sound on new message", 5, 5) $combo1 = GUICtrlCreateCombo ("YES", 195,5, 50) ; create first item GUICtrlSetData(-1,"NO","YES") ; add other item snd set a new default GUICtrlCreateLabel("flash tray icon on new message", 5, 30) $combo2 = GUICtrlCreateCombo ("YES", 195,30, 50) ; create first item GUICtrlSetData(-1,"NO","YES") ; add other item snd set a new default GUICtrlCreateLabel("Show new messages in", 5, 55) $combo3 = GUICtrlCreateCombo ("Msgbox", 180,55, 65) ; create first item GUICtrlSetData(-1,"traytip","Traytip") ; add other item snd set a new default GUICtrlCreateLabel("Delay to remove new message in sec.", 5, 80) $combo4 = GUICtrlCreateCombo ("5", 205,80, 40) ; create first item GUICtrlSetData(-1,"6|7|8|9|10","7") ; add other item snd set a new default $buttonOK = GUICtrlCreateButton("OK", 5, 160, 240, 40) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $buttonOK $read1 = GUICtrlRead($combo1) $read2 = GUICtrlRead($combo2) $read3 = GUICtrlRead($combo3) $read4 = GUICtrlRead($combo4) IniWrite("settings.ini", "General", "sound", $read1) IniWrite("settings.ini", "General", "icon", $read2) IniWrite("settings.ini", "General", "msg", $read3) IniWrite("settings.ini", "General", "showmsg", $read4) Exit If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndSelect WendoÝ÷ Ø2¢çÇ!©ky§r§^¶¢*ÞiÛºÖ)Þ÷²b~'¶*'±ªÞ§^ëHv÷öÛay"¶È(v°¢¹-+0k$ázâ)ÚÊ{)¨v'âq«b¢wë¢kaz)â汫¢+ØíMIYHÌÌìÌÌìMÑÉÐ5¥ÉÍÐÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌìÌÌì(9½QÉå%½¸(¥¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì((ìMÐM½µÉÕͱ¥¹¼(ìMÐå½ÕÈAÕ±¥%@ÉÍÌ¡%AÉÍÌĤ¡É¸)¥´ÀÌØíÍé%AIMLô%AÉÍÌÄ)¥´ÀÌØí¹A=IPôÌÌàäÄ(((ìMÑÉÐQ¡Q @MÉÙ¥Ì(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Q AMÑÉÑUÀ ¤((ì ÉÑ1¥Íѹ¥¹ÅÕ½ÐíM= -PÅÕ½Ðì¸(ìUÍ¥¹å½ÕÈ%@ÉÍ̹A½ÉÐÌÌàäĸ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ÀÌØí5¥¹M½ÐôQ A1¥ÍѸ ÀÌØíÍé%AIML°ÀÌØí¹A=IP¤((ì%Ñ¡M½ÐÉÑ¥½¸¥±Ì°á¥Ð¸)%ÀÌØí5¥¹M½Ðô´ÄQ¡¸á¥Ð(((ì ÉÑU$½ÈµÍÍÌ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(í¥´ÀÌØí==dôU% ÉÑ ÅÕ½Ðí5äMÉÙÈ¡%@èÅÕ½ÐìµÀìÀÌØíÍé%AIMLµÀìÅÕ½Ðì¤ÅÕ½Ðì°ÌÀÀ°ÈÀÀ¤(í¥´ÀÌØí¥ÐôU% Ñɱ ÉѥРÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÄÀ°ÈàÀ°ÄàÀ¤(íU%MÑMÑÑ ¤(((ì%¹¥Ñ¥±¥éÙÉ¥±Ñ¼ÉÁÉ͹н¹¹Ñ¥½¸(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)¥´ÀÌØí ½¹¹ÑM½Ðô´Ä(((í]¥Ð½È¹Áн¹¹Ñ¥½¸(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)¼(ÀÌØí ½¹¹ÑM½ÐôQ AÁÐ ÀÌØí5¥¹M½Ð¤)U¹Ñ¥°ÀÌØí ½¹¹ÑM½Ð±ÐìÐì´Ä(((ìÐ%@½±¥¹Ð½¹¹Ñ¥¹)¥´ÀÌØíÍé%A}ÁÑôM½ÑQ½%@ ÀÌØí ½¹¹ÑM½Ð¤()¥´ÀÌØíµÍ°ÀÌØíÉØ(ìU$5ÍÍ1½½À(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)]¡¥±Ä(ìÀÌØíµÍôU%Ñ5Í ¤((ìU$ ±½Í(ì´´´´´´´´´´´´´´´´´´´´(ì%ÀÌØíµÍôÀÌØíU%}Y9Q} 1=MQ¡¸á¥Ñ1½½À((ìQÉäѼɥ١ÕÀѼ¤ÈÀÐàåÑÌ(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(ÀÌØíÉØôQ AIØ ÀÌØí ½¹¹ÑM½Ð°ÈÀÐà¤((ì%Ñ¡É¥Ù¥±Ý¥Ñ ÉɽÈÑ¡¸Ñ¡Í½Ð¡Ì¥Í½¹¹Ñ(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(%ÉɽÈQ¡¸á¥Ñ1½½À((ìUÁÑÑ¡¥Ð½¹Ñɽ°Ý¥Ñ Ý¡ÐÝ¡ÙÉ¥Ù(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(M±Ð) ÍÀÌØíÉØôÅÕ½Ðí9%9} eÅÕ½Ðì(Q A ±½ÍM½Ð ÀÌØí ½¹¹ÑM½Ð¤(Q A ±½ÍM½Ð ÀÌØí5¥¹M½Ð¤(1¥ÍѸ ¤) ÍÀÌØíÉØôÅÕ½ÐìÍ¡ÕѽݸÅÕ½Ðì)Í¡Õѽݸ Ĥ) ÍÀÌØíÉØôÅÕ½Ðìɽ½ÐÅÕ½Ðì)Í¡Õѽݸ Ȥ) ÍÀÌØíÉØôÅÕ½Ðì±½äÅÕ½Ðì) ±½%¹ÁÕРĤ) ÍÀÌØíÉØôÅÕ½Ðì±½¸ÅÕ½Ðì) ±½%¹ÁÕÐ À¤) ÍÀÌØíÉرÐìÐìÅÕ½ÐìÅÕ½Ðì)QÉåMÑMÑÑ Ô¤)%ÀÌØíÍé%A}ÁÑôÅÕ½ÐìÄäȸÄØà¸À¸ÄÀÈÅÕ½ÐìQ¡¸(ÀÌØíÍé%A}ÁÑôÅÕ½Ðí!@ÅÕ½Ðì)±Í%ÀÌØíÍé%A}ÁÑôÅÕ½ÐìÄäȸÄØà¸À¸ÄÀÄÅÕ½ÐìQ¡¸(ÀÌØíÍé%A}ÁÑôÅÕ½Ðí=A8ÅÕ½Ðì)±Í%ÀÌØíÍé%A}ÁÑôÅÕ½ÐìÄäȸÄØà¸À¸ÄÀÀÅÕ½ÐìQ¡¸(ÀÌØíÍé%A}ÁÑôÅÕ½ÐíMIYHÅÕ½Ðì)±Í%ÀÌØíÍé%A}ÁÑôÅÕ½ÐìÄäȸÄØà¸À¸ÄÀÌÅÕ½ÐìQ¡¸(ÀÌØíÍé%A}ÁÑôÅÕ½Ðí HÅÕ½Ðì)¹%)M½Õ¹A±ä¡]¥¹½ÝͥȵÀìÅÕ½ÐìÀäÈíµ¥ÀäÈí¹½Ñ¥ä¹ÝØÅÕ½Ðì°À¤)QÉåQ¥À ÅÕ½Ðí É¥¡ÐÙ¸ÅÕ½ÐìµÀìÀÌØíÍé%A}ÁÑ°ÀÌØíÉØ°ÅÕ½ÐìÅÕ½Ðì°Ä¤)M±À ÜÀÀÀ¤)QÉåMÑMÑÑ ÄÀ¤)¹M±Ð)]¹(()%ÀÌØí ½¹¹ÑM½Ð±ÐìÐì´ÄQ¡¸Q A ±½ÍM½Ð ÀÌØí ½¹¹ÑM½Ð¤()Q AM¡Õѽݸ ¤(((ìչѥ½¸Ñ¼ÉÑÕɸ%@ÉÍÌɽ´½¹¹Ñͽи(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)Õ¹M½ÑQ½%@ ÀÌØíM!= -P¤(1½°ÀÌØíͽÈô11MÑÉÕÑ ÉÑ ÅÕ½ÐíÍ¡½ÉÐíÕÍ¡½ÉÐíÕ¥¹Ðí¡ÉlátÅÕ½Ðì¤((1½°ÀÌØíIÐô11 ±° ÅÕ½Ðí]ÌÉ|Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÑÁɹµÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíM!= -P°|(ÅÕ½ÐíÁÑÈÅÕ½Ðì±11MÑÉÕÑÑAÑÈ ÀÌØíͽȤ°ÅÕ½Ðí¥¹Ñ}ÁÑÈÅÕ½Ðì±11MÑÉÕÑÑM¥é ÀÌØíͽȤ¤(%9½ÐÉɽȹÀÌØíIÑlÁtôÀQ¡¸(ÀÌØíIÐô11 ±° ÅÕ½Ðí]ÌÉ|Ìȹ±°ÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½Ðí¥¹Ñ}¹Ñ½ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì±11MÑÉÕÑÑÑ ÀÌØíͽȰ̤¤(%9½ÐÉɽÈQ¡¸ÀÌØíIÐôÀÌØíIÑlÁt(±Í(ÀÌØíIÐôÀ(¹%((ÀÌØíͽÈôÀ((IÑÕɸÀÌØíIÐ)¹Õ¹()Õ¹1¥ÍѸ ¤(ì ÉÑ1¥Íѹ¥¹ÅÕ½ÐíM= -PÅÕ½Ðì¸(ìUÍ¥¹å½ÕÈ%@ÉÍ̹A½ÉÐÌÌàäĸ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ÀÌØí5¥¹M½ÐôQ A1¥ÍѸ ÀÌØíÍé%AIML°ÀÌØí¹A=IP¤(ì%Ñ¡M½ÐÉÑ¥½¸¥±Ì°á¥Ð¸)%ÀÌØí5¥¹M½Ðô´ÄQ¡¸á¥Ð(í]¥Ð½È¹Áн¹¹Ñ¥½¸(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)¼(ÀÌØí ½¹¹ÑM½ÐôQ AÁÐ ÀÌØí5¥¹M½Ð¤)U¹Ñ¥°ÀÌØí ½¹¹ÑM½Ð±ÐìÐì´Ä(ìÐ%@½±¥¹Ð½¹¹Ñ¥¹)¥´ÀÌØíÍé%A}ÁÑôM½ÑQ½%@ ÀÌØí ½¹¹ÑM½Ð¤)¹Õ¹ Can somebody please help me with inplementing the inireads into the above script? Thanks! Link to comment Share on other sites More sharing options...
PcExpert Posted May 29, 2007 Author Share Posted May 29, 2007 Cant autoit do this? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 Hi all, I was just modifying the TCPSend and the TCPRecv to fit with my needs. Everything works perfect, BUT when you close TCPSend on the computer where you are sending the message from, then TCPRecv will also close on the computer where you where sending the message to. How to solve the problem? (I want to be able to send a message when I want, so TCPRecv needs to be running all the time) My Codes: TCPSend: expandcollapse popupTCPStartUp() $msg207 = Inputbox("Cliënt Kiezen", "naar Ù[ÙHÛÛ][Ù]]XÚÙÝ]ÛÜ[ÈSÔSÙX]YYÈÛH]XÚH[[XHÛÙÙ§V÷C²¦bb33c¶×6s#rÒgV÷C´õTâgV÷C²FVà¢b33c·7¤DE$U52ÒgV÷C³$ȸÄØà¸À¸ÄÀÄÅÕ½Ðì)±Í%ÀÌØíµÍÈÀÜôÅÕ½Ðí!@ÅÕ½ÐìQ¡¸(ÀÌØíÍé%AESS = "192.168.0.102" ElseIf $msg207 = "" Then � ÜÞTQTÔÈH ][ÝÌNLML ][ÝÂ[YÈÙ]ÛÛYH]ØXH[ÂÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²6WBb33c·7¤DE$U52FòvW&WfW"FR4U%dU"8]Ý¥±°¡¹A¹µ¥¹Ñ¼¸%@ÉÍÌ)¥´ÀÌØí¹A=IPôÌÌàäÄ(ì%¹¥éalize a variable to represent a connection ;==============================OOOOOOOOOOOOOOB[H ÌÍÐÛÛXÝYÛØÚÙ]HLBÐ][ÈÛÛXÝÈÑTbBG2æBõ%B33£³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓôôôôôôô(ÀÌØí ½¹¹ÑM½ÐôQ A ½¹¹Ð ÀÌØíÍé%AIML°ÀÌØí¹A=IP¤) $szData ; If there is an error... show it If @error Then MsgBox LL ][ÝÑÜ][ÝË ][ÝÕÔÛÛXÝZ[YÚ]ÔÐHÜ ][ÝÈ [ÄW'&÷"£²bFW&R2æòW'&÷"Æö÷âçWF&÷f÷"FF£²Fò6VæBFòFAMIYH¸)±Í(í1½½À½ÉÙÈÍ¥¹½ÈÑѼ͹ѼѡMIYH(]¡¥±± ; InputBox for data to transmit $szData = InputBox("]HÜÙ][ÝË ][ÝÑ[]HÈ[ÛZ]ÈHÑTT][ÝË V÷C²gV÷C²ÂgV÷C²gV÷C²Â#sRÂsR¢¢²bFW6æ6VÂFRçWD=à½È±Ù¥Ð±¹¬Ýá¥Ð½ÕȽÉÙȱ½½À(%ÉɽÈ=ÈÀÌØíÍé!ta = "" Then ExitLoop ; We should have data in ÜÞ]K]È][ÈÙ[]ÝYÚÝÛÛXÝYÛØÚÙ]Å6VæBb33c´6öææV7FVE6ö6¶WBÂb33c·7¤FF¢¢²bFR6VæBfÆVB¥Ñ ÉɽÈÑ¡¸Ñ¡Í½Ð¡Ì¥Í½¹¹Ñ(ì´´´´´´´´´´´´´´´´´´´´´´´´´------------------------------------- If @error Then ExitLoop Q[[YoÝ÷ Ù0Eç/jëh×6Dim $szIPADDRESS = @IPAddress1 Dim $nPORT = 33891 ; Start The TCPÙXÙÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÔÝ BÈÜVFRÆ7FVæærgV÷Cµ4ô4´UBgV÷C²à£²W6ær÷W"FG&W72æB÷'B33ĸ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ÀÌØí5¥¹M½ÐôQ A1¥ten($szIPADDRESS, $nPORT) ; If the Socket creation fails, exit. Y ÌÍÓXZ[ÛØÚÙ]HLH[^]ÈÜX]HHÕRHÜYÜØYÙÂÏOOOOOOOOOOOÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²æFƦRf&&ÆRFò&W&W6VçB6¹¹Ñ¥½¸(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)¥´ÀÌØí ½¹¹ÑSocket = -1 ;Wait for and Accept a connection ;============================OOOOOOOOOOOOOOOOOB ÌÍÐÛÛXÝYÛØÚÙ]HÔXØÙ ÌÍÓXZ[ÛØÚÙ]¥VçFÂb33c´6öææV7FVE6ö6¶WBfÇC²fwC²Ó£²vWBöb6ÆVçB6öææV7Fæp¤FÒÀÌØíÍé%A}ÁÑôM½ÑQ½%@ ÀÌØí ½¹¹ÑM½Ð¤()¥´ÀÌØíµÍ°À6;recv ; GUI Message Loop ;============================================== ;HÈXÙZ]H ÊH ]ÂËKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐ¥vÆR¢b33c·&V7bÒD5&V7bb33c´6öææV7FVE6аÈÀÐà¤((ì%Ñ¡É¥Ù¥±Ý¥Ñ ÉɽÈÑ¡¸Ñ¡Í½Ð¡Ìsconnected ;---------------------------------------------------------------BYÜ[^]ÛÜÈ]HHY]ÛÛÛÚ]Ú]ÙH]HV6VfV@£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒТ%ÀÌØíÉرÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸5Í ½à ØаÅÕ½Ðí É¥¡ÐÙ¸ÅÕt; & $szIP_Accepted, $recv) WEnd If $ConnectedSocket <ÉÝÈLH[ÔÛÜÙTÛØÚÙ] ÌÍÐÛÛXÝYÛØÚÙ] BÔÚ]ÝÛ BÈ[ÝöâFò&WGW&âFG&W72g&öÒ6öææV7FVB6ö6¶WBࣲÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒ´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)Õ¹M½ÑQ½%@ ÀÌØíM!= -P Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]][ÝÊBØØ[ ÌÍØT]HØ[ ][ÝÕÜÌÌÌ ][ÝË ][ÝÚ[ ][C²ÂgV÷C¶vWGVW&æÖRgV÷C²ÂgV÷C¶çBgV÷C²Âb33cµ4ô4´UBÂð¢gVÐíÁÑÈÅÕ½Ðì±11MÑÉÕÑÑAÑÈ ÀÌØíͽȤ°ÅÕ½Ðí¥¹Ñ}ÁÑÈÅÕ½Ðì±11MÑÉÕÑSize($sockaddr)) If Not @error And $aRet[0] = 0 Then ÌÍØT]HØ[ ][ÝÕÜÌÌÌ ][ÝË ][ÝÜÝ][ÝË ][ÝÚ[]ÛØIV÷C²ÂgV÷C¶çBgV÷C²ÄDÄÅ7G'V7DvWDFFb33c·6ö6¶FG"Ã2¢bæ÷BWɽÈQ¡¸ÀÌØíIÐôÀÌØíIÑlÁt(±Í(ÀÌØíIÐôÀ(¹f $sockaddr = 0 Return $aRet EndFunc Thanks!the error is in CODE ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop because when it doesn't receve @error is <>0, also when the tcpsend not trasmetting., not because the socket has disconnected A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now