Página 1 de 1

Error al enviar macro [TCPsend]

Publicado: 12 Dic 2013, 18:23
por Naker90
Hola indetectables, bueno tengo el siguiente problema cuando envió texto desde mi server al cliente si se visualiza en el listview, pero cuando lo que envió es un macro como @Computername me dice que tengo un error en el array. He probado pasando en el server de string a binario y luego en el cliente de binario a string pero tampoco.
Aquí dejo el code que tengo de momento:
Cliente:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\antonio\desktop\form1.kxf
Opt('TCPTimeout', 0)
$Form1 = GUICreate("SpyCam V1.0  ", 787, 340, 110, 129)
$Button1 = GUICtrlCreateButton("Start", 8, 216, 75, 25)
$Button2 = GUICtrlCreateButton("Stop", 88, 216, 75, 25)
$Group1 = GUICtrlCreateGroup("", 0, 200, 169, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 0, 256, 169, 81)
$Button3 = GUICtrlCreateButton("Opciones", 8, 272, 155, 25)
$Button4 = GUICtrlCreateButton("Crear Server", 8, 304, 155, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1 = GUICtrlCreateListView("IDENTIFICADOR|PUERTO|IP|ORDENADOR|SISTEMA OPERATIVO|WEB CAM", 0, 0, 786, 198)
$Group3 = GUICtrlCreateGroup("", 520, 200, 265, 137)
$Label1 = GUICtrlCreateLabel("PC-User: ", 528, 216, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("...", 600, 216, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Sistema Operativo: ", 528, 240, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("...", 672, 240, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Puerto:", 528, 264, 53, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("...", 584, 264, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Servers Online:", 528, 288, 110, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("...", 640, 288, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("Estado:", 528, 312, 57, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Esperando...", 592, 312, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

		Case $Form1
		case $Button1
			GUICtrlSetData($Label2, @ComputerName)
			GUICtrlSetData($Label4, @OSVersion)
			GUICtrlSetData($Label8, 'Online [0]')
			GUICtrlSetData($Label10, 'En Escucha..')
		Server()

	case $Button2
		TCPShutdown()

	EndSwitch
WEnd

Func Server()

  TCPStartup()

$MainSocket = TCPListen('0.0.0.0', 1555)
If $MainSocket = -1 Then Exit
$ConnectedSocket = -1
Do
  $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1

Do
$string = TCPRecv($ConnectedSocket, 2048)
$INFO = StringSplit($string, '|', 1)
Until $INFO[7] = 'OK'

GUICtrlCreateListViewItem($INFO[1] & '|' & $INFO[2] & '|' & $INFO[3] & '|' & $INFO[4] & '|' & $INFO[5] & '|' & $INFO[6], $ListView1)

Sleep(1000)

GUICtrlSetData($Label8, 'Online [' & _GUICtrlListView_GetItemCount($ListView1) & ']')

EndFunc
Server:
TCPStartup()

While 1

$SERVERNAME = 'Test'
$PUERTO = '1555'

$ConnectedSocket = -1
Do
$ConnectedSocket = TCPConnect('127.0.0.1', 1555)
Until $ConnectedSocket <> -1

TCPSend($ConnectedSocket, $SERVERNAME & '|' & $PUERTO & '|' & @IPAddress1 & '|' &  @ComputerName & '|' & @OSVersion & '|' & 'BETA' & '|' & 'OK')

WEnd
Saludos

Re: Error al enviar macro [TCPsend]

Publicado: 12 Dic 2013, 18:53
por M3
No tengo AutoIt a mano ahora mismo , pero proba asi

Until StringInStr($string , "OK" )

Declara las variables , verifica el array de retorno del server uno a uno a ver que te volve e sacara donde esta el error ,
Se quieres , en quando lhegar a casa te subo el code mejorado ,

De hecho , hice una aplicaccion a privado hace unos meses con el mismo nombre ( similar a tuya , como cammycam)

Suerte compa


Re: Error al enviar macro [TCPsend]

Publicado: 12 Dic 2013, 20:11
por Naker90
Solucionado, Estoy haciendo algo parecido al cammy porque como nunca habia praticado con las conexiones TCP pues me decidi ha hacer algo a ver que sale.
Gracias Crack!
Saludos

Re: Error al enviar macro [TCPsend]

Publicado: 12 Dic 2013, 22:37
por Pink
Declara las variables :S