Advertisement
Jeahaha

Untitled

Mar 13th, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.27 KB | None | 0 0
  1. ;Script(client)1:
  2. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  3. #AutoIt3Wrapper_outfile=client.exe
  4. #AutoIt3Wrapper_Res_Fileversion=0.0.0.5
  5. #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
  6. #AutoIt3Wrapper_Res_LegalCopyright=Jeahaha
  7. #AutoIt3Wrapper_Res_Language=1031
  8. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  9.  
  10. #include <ButtonConstants.au3>
  11. #include <EditConstants.au3>
  12. #include <GUIConstantsEx.au3>
  13. #include <WindowsConstants.au3>
  14. #include <file.au3>
  15. #Region ### START Koda GUI section ### Form=c:\users\timo2\desktop\programieren\autoit\tcptests\client.kxf
  16. $Form2 = GUICreate("", 405, 221, 253, 175)
  17. $Edit1 = GUICtrlCreateEdit("", 0, 0, 401, 185, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
  18. $Input1 = GUICtrlCreateInput("", 0, 192, 321, 21)
  19. $Button1 = GUICtrlCreateButton("", 328, 192, 75, 25, $WS_GROUP)
  20. GUISetState(@SW_SHOW)
  21. Dim $Form2_AccelTable[1][2] = [["{ENTER}", $Button1]]
  22. GUISetAccelerators($Form2_AccelTable)
  23. #EndRegion ### END Koda GUI section ###
  24.  
  25. $IP = "127.0.0.1" ; IP
  26.  
  27. TCPStartUp()
  28.  
  29. $socket = TCPConnect( $IP, 65432 )
  30. If $socket = -1 Then Exit
  31.  
  32. While 1
  33.     $nMsg = GUIGetMsg()
  34.     Switch $nMsg
  35.         Case $GUI_EVENT_CLOSE
  36.             TCPCloseSocket( $socket )
  37.             Exit
  38.         Case $Button1
  39.             $inp = GUICtrlRead( $Input1 )
  40.             TCPSend( $socket , $inp )  ;soll dann in die edit und in die log.txt
  41.     EndSwitch
  42. WEnd
  43.  
  44.  
  45.  
  46. ;Script2(Server):
  47. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  48. #AutoIt3Wrapper_outfile=server.exe
  49. #AutoIt3Wrapper_Res_Fileversion=0.0.1.6
  50. #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
  51. #AutoIt3Wrapper_Res_LegalCopyright=Jeahaha
  52. #AutoIt3Wrapper_Res_Language=1031
  53. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  54.  
  55. #include <ButtonConstants.au3>
  56. #include <EditConstants.au3>
  57. #include <GUIConstantsEx.au3>
  58. #include <WindowsConstants.au3>
  59. #include <file.au3>
  60. #Include <Timers.au3>
  61. #include <GuiStatusBar.au3>
  62. #include <ProgressConstants.au3>
  63. #Region ### START Koda GUI section ### Form=c:\users\timo2\desktop\programieren\autoit\tcptests\server.kxf
  64. $Form1 = GUICreate("", 619, 362, 192, 124)
  65. $Edit1 = GUICtrlCreateEdit("", 0, 0, 617, 337, BitOR($ES_READONLY,$WS_HSCROLL,$WS_VSCROLL))
  66. $Input1 = GUICtrlCreateInput("", 0, 336, 529, 21)
  67. $Button1 = GUICtrlCreateButton("", 536, 336, 75, 25, $WS_GROUP)
  68. GUISetState(@SW_SHOW)
  69. Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Button1]]
  70. GUISetAccelerators($Form1_AccelTable)
  71. #EndRegion ### END Koda GUI section ###
  72.  
  73. $IP = "127.0.0.1" ; IP
  74.  
  75. TCPStartUp()
  76.  
  77. $MainSocket = TCPListen($IP, 65432,  100 )
  78. If $MainSocket = -1 Then Exit
  79.  
  80. While 1
  81.     $nMsg = GUIGetMsg()
  82.     Switch $nMsg
  83.         Case $GUI_EVENT_CLOSE
  84.             Exit
  85.     EndSwitch
  86.  
  87.     $ConnectedSocket = TCPAccept( $MainSocket)
  88.     If $ConnectedSocket >= 0 Then
  89.         GUICtrlSetData( $Edit1 , @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & "  " & "Eingehende Verbindung" & @CRLF, 1 )
  90.         _FileWriteToLine( "log.txt" , 1 , @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & "  " & "Eingehende Verbindung" )
  91.     EndIf
  92.  
  93. $Rec = TCPRecv( $MainSocket , 128 )
  94.  
  95.     If $Rec Then
  96.         GUICtrlSetData( $Edit1 , $Rec , 1 )
  97.         _FileWriteToLine( "log.txt" , 1 , @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & "  " & $Rec )   ;hier soll das oben beschriebene ausgeführt werden , geht aber nicht :(
  98.     EndIf
  99. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement