Jump to content
Sign in to follow this  
yucatan

TCP error

Recommended Posts

yucatan

;SERVER!! Start Me First !!!!!!!!!!!!!!!

$g_IP = "127.0.0.1"

#include <Inet.au3>

; Start The TCP Services

;==============================================

TCPStartUp()

; Create a Listening "SOCKET"

;==============================================

$MainSocket = TCPListen($g_IP, 81, 100 )

If $MainSocket = -1 Then Exit

; look for client connection

;--------------------------------------------------

$teller = 0

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

if $ConnectedSocket = -1 then MsgBox(4096, "Test", $connectedsocket)

when i run this code i get errr -1 on this

if $ConnectedSocket = -1 then MsgBox(4096, "Test", $connectedsocket)

so something is going with with the tcpacept but i cant find what can somebody help me on this ?

Share this post


Link to post
Share on other sites
Andreik

Use @error:

If IPAddr is incorrect @error is set to 1.

If port is incorrect @error is set to 2.


When the words fail... music speaks

Share this post


Link to post
Share on other sites
yucatan

Use @error:

If IPAddr is incorrect @error is set to 1.

If port is incorrect @error is set to 2.

i already try but the problem is the $connectedsocket = 01 but @error = 0 so the port and IP are good so i dont understand

Share this post


Link to post
Share on other sites
Jos

i already try but the problem is the $connectedsocket = 01 but @error = 0 so the port and IP are good so i dont understand

How are you retrieving the value of @Error ? show the code you run and the result you get.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Andreik

Use this function to create listening server

Func _TCPStartServer()
    Local $sResult
    $sResult = TCPStartup()
    If $sResult = 0 Then
        MsgBox(0, "Error", "Unable to startup TCP Services!")
        Exit
    EndIf
    $oListenSocket = TCPListen(@IPAddress1, 81, 100)
    If $oListenSocket = -1 Then
        MsgBox(0, "Error", "Unable to start listening on port 81")
        Exit
    EndIf
EndFunc

hope that helps


When the words fail... music speaks

Share this post


Link to post
Share on other sites
yucatan

How are you retrieving the value of @Error ? show the code you run and the result you get.

MsgBox(4096, "Test", @error)

Share this post


Link to post
Share on other sites
yucatan

MsgBox(4096, "Test", @error)

you know what i show you the code and i explane what i wanne to do..

server

;SERVER!! Start Me First !!!!!!!!!!!!!!!
$g_IP = "127.0.0.1"
#include <Inet.au3>
; Start The TCP Services
;==============================================
TCPStartUp()
; Create a Listening "SOCKET"
;==============================================
$MainSocket = TCPListen($g_IP, 81, 100 )
If $MainSocket = -1 Then Exit
;  look for client connection
;--------------------------------------------------
$teller = 0
While 1
$ConnectedSocket = TCPAccept( $MainSocket)
MsgBox(4096, "Test", @error)

If $ConnectedSocket >= 0 Then
    
$Recv = TCPRecv( $ConnectedSocket, 8000 )
MsgBox(4096, "Test", $recv)


$guidenstream = StringSplit($recv, "|")


if $guidenstream[1] = 1 then 
If FileExists ($guidenstream[1] & ".txt") then 
FileDelete ($guidenstream[1] & ".txt")
EndIf

$file = FileOpen($guidenstream[1] & ".txt", 1)
FileWrite($file, "streaming")
FileClose($file)


if $guidenstream[2] = 0 then 
FileDelete ($guidenstream[1] & ".txt")


EndIf
EndIf
EndIf
Wend

client

#NoTrayIcon
#include <Inet.au3>
;CLIENT!!!!!!!! Start SERVER First... dummy!!
$g_IP = "127.0.0.1"
$guid = InputBox("Guid", "Enter here your cod4 guid pleas.", "", "")
$stream = 0
; Start The TCP Services
;==============================================
TCPStartUp()
; Connect to a Listening "SOCKET"
While 1
if ProcessExists ( "yctnanticheat.exe" ) then
    $stream = 1
Else
    MsgBox(4096, "Error Streamer.", " Yucatan anti cheat is missing files plz reinstall.", 10)
Exit
EndIf
WEnd
Dim $guidenstream = $guid &"|"& $stream


$socket = TCPConnect( $g_IP, 81 )
If $socket = -1 Then 
MsgBox(4096, "Error streamer.", "Could not Connect to stream server")
exit
EndIf

$send = TCPSend( $socket, $guidenstream )

MsgBox(4096, "Test", @error)

what i want it the following

when yctnanticheat.exe is running then $stream = 1 $stream&$guid sent the 2 vars to the server make a file $guid.txt

when $stream is set to 0 on the computer(thats when yctnanticheat.exe quits) then sent to the server Delete the file $guid.txt

pleas take a look at my code then.

and it would be nice if he can sent it one time and then just sleep until $stream = then and then send to the server that $stream = 0 because els i get a connecting during forever so it would be cool if he waits until teh $stream changes..

Edited by yucatan

Share this post


Link to post
Share on other sites
Andreik

use @IPAddress1 for IPAddr


When the words fail... music speaks

Share this post


Link to post
Share on other sites
yucatan

use @IPAddress1 for IPAddr

i tryed no result he does the same... the code is above here..

its working now only one stange thing.

when i runt them both its works but the wierd is that the client is givving this error

10061 the TCPConnect

MsgBox(4096, "Error streamer.", @error)

i get 10061 thats the Windows API WSAGetLasterror can wher i can find that that number means ?

Edited by yucatan

Share this post


Link to post
Share on other sites
yucatan

i tryed no result he does the same... the code is above here..

its working now only one stange thing.

when i runt them both its works but the wierd is that the client is givving this error

10061 the TCPConnect

MsgBox(4096, "Error streamer.", @error)

i get 10061 thats the Windows API WSAGetLasterror can wher i can find that that number means ?

i already tryed as ip "127.0.0.1" and "192.168.1.70" my own pc ip adres and i try @IPAddress1

what i do wrong....

Share this post


Link to post
Share on other sites
Delta

Below is a modification to your server that is tidied and works, enjoy. If stream is set to 1 and the file does not already exist a GUID file is created. If the stream is set to 0 the file is deleted regardless if it exists or not.

#include <Inet.au3>

$g_IP = "127.0.0.1"
TCPStartup()

$MainSocket = TCPListen($g_IP, 81, 100)
If $MainSocket = -1 Then Exit
While 1
    $ConnectedSocket = TCPAccept($MainSocket)
    If $ConnectedSocket >= 0 Then
        $Recv = TCPRecv($ConnectedSocket, 8000)
        $guidenstream = StringSplit($Recv, "|")
        If $guidenstream[2] == 1 Then
            If FileExists($guidenstream[1]) == 0 Then
                FileWrite($guidenstream[1], "streaming")
            EndIf
        EndIf
        If $guidenstream[2] <> 1 Then
            FileDelete($guidenstream[1])
        EndIf
    EndIf
WEnd

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites
yucatan

Below is a modification to your server that is tidied and works, enjoy. If stream is set to 1 and the file does not already exist a GUID file is created. If the stream is set to 0 the file is deleted regardless if it exists or not.

#include <Inet.au3>

$g_IP = "127.0.0.1"
TCPStartup()

$MainSocket = TCPListen($g_IP, 81, 100)
If $MainSocket = -1 Then Exit
While 1
    $ConnectedSocket = TCPAccept($MainSocket)
    If $ConnectedSocket >= 0 Then
        $Recv = TCPRecv($ConnectedSocket, 8000)
        $guidenstream = StringSplit($Recv, "|")
        If $guidenstream[2] == 1 Then
            If FileExists($guidenstream[1]) == 0 Then
                FileWrite($guidenstream[1], "streaming")
            EndIf
        EndIf
        If $guidenstream[2] <> 1 Then
            FileDelete($guidenstream[1])
        EndIf
    EndIf
WEnd

i tested maby u wanne take a look to my server code and client code my client still say Could not connect to stream server.

somewhere here in this post there are one or two things that needs to be added maby i wanne take a look to that

server

;SERVER!! Start Me First !!!!!!!!!!!!!!!
$g_IP = "192.168.1.70"
#include <Inet.au3>
; Start The TCP Services
;==============================================
TCPStartUp()
; Create a Listening "SOCKET"
;==============================================
$MainSocket = TCPListen($g_IP, 81, 100 )
If $MainSocket = -1 Then Exit
;  look for client connection
;--------------------------------------------------
$teller = 0
While 1
$ConnectedSocket = TCPAccept( $MainSocket)


If $ConnectedSocket >= 0 Then
    msgbox(0,"","my server - Client Connected")
    $Recv = TCPRecv( $ConnectedSocket, 8000 )


$guidenstream = StringSplit($recv, "|")



if $guidenstream[2] = 1 then 
If FileExists ($guidenstream[1] & ".txt") then 
FileDelete ($guidenstream[1] & ".txt")
EndIf

$file = FileOpen($guidenstream[1] & ".txt", 1)
FileWrite($file, "streaming")
FileClose($file)


if $guidenstream[2] = 0 then 
FileDelete ($guidenstream[1] & ".txt")


EndIf
EndIf
EndIf
Wend

client

#NoTrayIcon
#include <Inet.au3>
;CLIENT!!!!!!!! Start SERVER First... dummy!!
$g_IP = "192.168.1.70"
$guid = InputBox("Guid", "Enter here your cod4 guid pleas.", "", "")
$stream = 0
; Start The TCP Services
;==============================================
TCPStartUp()
; Connect to a Listening "SOCKET"
While 1
if ProcessExists ( "yctnanticheat.exe" ) then
    $stream = 1
Else
    MsgBox(4096, "Error Streamer.", " Yucatan anti cheat is missing files plz reinstall.")
Exit
EndIf

Dim $guidenstream = $guid &"|"& $stream


$socket = TCPConnect( $g_IP, 81 )
If $socket = -1 Then 
MsgBox(4096, "Error streamer.", @error)
MsgBox(4096, "Error streamer.", "Could not Connect to stream server")
exit
EndIf
if $socket = not -1 then MsgBox(4096, "Error streamer.", "Connected.")
$send = TCPSend( $socket, $guidenstream )

WEnd

this replay i mean this needs to be added..

what i want it the following

when yctnanticheat.exe is running then $stream = 1 $stream&$guid sent the 2 vars to the server make a file $guid.txt

when $stream is set to 0 on the computer(thats when yctnanticheat.exe quits) then sent to the server Delete the file $guid.txt

pleas take a look at my code then.

and it would be nice if he can sent it one time and then just sleep until $stream = then and then send to the server that $stream = 0 because els i get a connecting during forever so it would be cool if he waits until teh $stream changes..

Edited by yucatan

Share this post


Link to post
Share on other sites
Delta

Below is a revised server and client to your specifications, enjoy. I took out the error reporting because 9 times out of 10, at least from what I have seen the error is reported before the function is even executed and it becomes a false error.

server

#include <Inet.au3>

$g_IP = "127.0.0.1"

TCPStartup()

Dim $MainSocket = TCPListen($g_IP, 81, 100)
If $MainSocket = -1 Then Exit
While 1
    $ConnectedSocket = TCPAccept($MainSocket)
    If $ConnectedSocket >= 0 Then
        $Recv = TCPRecv($ConnectedSocket, 1024)
        If $Recv <> "" Then
            $guidenstream = StringSplit($Recv, "|")
            If $guidenstream[2] == 1 Then
                If FileExists($guidenstream[1]) == 0 Then
                    FileWrite($guidenstream[1], "streaming")
                EndIf
            EndIf
            If $guidenstream[2] == 0 Then
                FileDelete($guidenstream[1])
            EndIf
        EndIf
    EndIf
WEndoÝ÷ ÙÉbz{ZºÚ"µÍÈÓÕ^RXÛÛÚ[ÛYH Ò[]]LÉÝÂÌÍÙ×ÒTH    ][ÝÌLËI][ÝÂÌÍÙÝZYH[]Þ
    ][ÝÑÝZY  ][ÝË  ][ÝÑ[H[ÝÛÙ
ÝZYXË][ÝË   ][ÝÉ][ÝË    ][ÝÉ][ÝÊBÌÍÜÝX[HHÌÍÜÝX[XÚXÚÈHÔÝ

BÚ[HBRYØÙÜÑ^ÝÊ   ][ÝÞXÝ[XÚX]^I][ÝÊH[   ÌÍÜÝX[XÚXÚÈH[BIÌÍÜÛØÚÙ]HÔÛÛXÝ
    ÌÍÙ×ÒTJBBUÔÙ[
    ÌÍÜÛØÚÙ] ÌÍÙÝZY  [É][ÝßI][ÝÊBBUÔÛÜÙTÛØÚÙ]
    ÌÍÜÛØÚÙ]
BBIÌÍÜÝX[XÚXÚÈHBQ[YBRYØÙÜÑ^ÝÊ  ][ÝÞXÝ[XÚX]^I][ÝÊHOH[BSÙÐÞ
M   ][ÝÑÜÝX[Y][ÝË ][ÝÈ]XØ][[HÚX]ÈZÜÚ[È[ÈZ[Ý[][ÝÊBBIÌÍÜÛØÚÙ]HÔÛÛXÝ
    ÌÍÙ×ÒTJBBUÔÙ[
    ÌÍÜÛØÚÙ] ÌÍÙÝZY  [É][Ýß   ][ÝÊBBUÔÛÜÙTÛØÚÙ]
    ÌÍÜÛØÚÙ]
BBQ^]Q[YÑ[
Edited by Deltaforce229

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites
yucatan

Below is a revised server and client to your specifications, enjoy. I took out the error reporting because 9 times out of 10, at least from what I have seen the error is reported before the function is even executed and it becomes a false error.

server

#include <Inet.au3>

$g_IP = "127.0.0.1"

TCPStartup()

Dim $MainSocket = TCPListen($g_IP, 81, 100)
If $MainSocket = -1 Then Exit
While 1
    $ConnectedSocket = TCPAccept($MainSocket)
    If $ConnectedSocket >= 0 Then
        $Recv = TCPRecv($ConnectedSocket, 1024)
        If $Recv <> "" Then
            $guidenstream = StringSplit($Recv, "|")
            If $guidenstream[2] == 1 Then
                If FileExists($guidenstream[1]) == 0 Then
                    FileWrite($guidenstream[1], "streaming")
                EndIf
            EndIf
            If $guidenstream[2] == 0 Then
                FileDelete($guidenstream[1])
            EndIf
        EndIf
    EndIf
WEndoÝ÷ ÙÉbz{ZºÚ"µÍÈÓÕ^RXÛÛÚ[ÛYH Ò[]]LÉÝÂÌÍÙ×ÒTH    ][ÝÌLËI][ÝÂÌÍÙÝZYH[]Þ
    ][ÝÑÝZY  ][ÝË  ][ÝÑ[H[ÝÛÙ
ÝZYXË][ÝË   ][ÝÉ][ÝË    ][ÝÉ][ÝÊBÌÍÜÝX[HHÌÍÜÝX[XÚXÚÈHÔÝ

BÚ[HBRYØÙÜÑ^ÝÊ   ][ÝÞXÝ[XÚX]^I][ÝÊH[   ÌÍÜÝX[XÚXÚÈH[BIÌÍÜÛØÚÙ]HÔÛÛXÝ
    ÌÍÙ×ÒTJBBUÔÙ[
    ÌÍÜÛØÚÙ] ÌÍÙÝZY  [É][ÝßI][ÝÊBBUÔÛÜÙTÛØÚÙ]
    ÌÍÜÛØÚÙ]
BBIÌÍÜÝX[XÚXÚÈHBQ[YBRYØÙÜÑ^ÝÊ  ][ÝÞXÝ[XÚX]^I][ÝÊHOH[BSÙÐÞ

M   ][ÝÑÜÝX[Y][ÝË ][ÝÈ]XØ][[HÚX]ÈZÜÚ[È[ÈZ[Ý[][ÝÊBBIÌÍÜÛØÚÙ]HÔÛÛXÝ
    ÌÍÙ×ÒTJBBUÔÙ[
    ÌÍÜÛØÚÙ] ÌÍÙÝZY  [É][Ýß   ][ÝÊBBUÔÛÜÙTÛØÚÙ]
    ÌÍÜÛØÚÙ]
BBQ^]Q[YÑ[

hi deltaforce thx alot from now on i will hold my code nice i needed another script i already had it but i was a mess..

i did the same as you did for me then you can read the code normal(A) thx alot from now on my code wil be clean.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×