Jump to content

Recommended Posts

Posted

Hello,

I just want to know if this is a bug?

 
Global $Info = _GetServerInfo()
If @error Then
 ConsoleWrite("Error " & @error & " getting info" & @CRLF)
Else
 ConsoleWrite($Info & @CRLF)
EndIf
Func _GetServerInfo()
 UDPStartup()
 Local $socket = UDPOpen("192.168.5.5", 20500)
 If @error <> 0 Then Return SetError(1, 0, "")
 UDPSend($socket, "GetServerInfo" & Chr(0))
 If @error <> 0 Then Return SetError(2, 0, "")
 Local $data = UDPRecv($socket, 50, 2) ; if UDP-server is not reachable, then no error is set and no array is created
 If @error <> 0 Then Return SetError(3, 0, "")
 UDPCloseSocket($socket)
 UDPShutdown()
 Return $data[0]
EndFunc   ;==>_GetServerInfo

 

If server IP is local IP then an error is thrown as expected.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted

Hi,

If the server is reachable you mean?

I have the same issue, it returns an empty string with the flag set to 2.

Br, FireFox.

Posted

So should I open a ticket in Bugtracker?

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

  • Developers
Posted (edited)

It looks like the @Error isn't set in case the FD_ISSET call fails, meaning the UDP socket isn't ready, so guess this is indeed an bug that needs to be looked at.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Thanks, Jon!

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

  • 5 months later...
Posted (edited)
Hi Guys,
 
Since the version 10, this TCPRecv change has broken my script... if I compile the script with version 8 the connection is stable and doesn't throw any @error
 
While 1
  $recv = TCPRecv($Socket, 1024)
    If @error Then
      Connect()
    EndIf

now when i compile the same script with version 10 it just connects, @error's - disconnects, then connects again, @errors - disconnects, in a loop.

I viewed the @error with a messagebox it returned -1, why would this work on the old 8 but not on the new 10 version. is it one of those, Fix one thing, break another scenario?

Thanks;

Edited by FrankwazHere

;Frank. 

  • 1 month later...
Posted (edited)

I have a small script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


If Not UDPStartup() Then
    MsgBox (0,"UDPStartup",@error & "TunnelDisabledActionString")
Else
    $UDPLogPort = Random(20000,65535,1)
    $UDPLogReceiver = UDPBind("127.0.0.1",$UDPLogPort)
    If (@error > 0) Then
        $UDPLogPort = Random(20000,65535,1)
        $UDPLogReceiver = UDPBind("127.0.0.1",$UDPLogPort)
        If (@error > 0) Then
            MsgBox (0,"UDPBind",@error&"TunnelDisabledActionString")
            $UDPLogReceiver[0] = 0
        EndIf
    Else
            MsgBox(0,"UDPBind","Realsocket=" & $UDPLogReceiver[1] & " IP=" & $UDPLogReceiver[2]&" port= "& $UDPLogReceiver[3])
    EndIf
EndIf
For $I = 1 to 1
    If $UDPLogReceiver[0] <> 0 Then
        $received = UDPRecv($UDPLogReceiver,16000)
        If @error And (@error <> 10040) Then
            MsgBox(0,"UDPRecv",@error)
        Else
            MsgBox(0,"UDPRecv",$I&" "&$received)
        EndIf
    EndIf
    Sleep(100)
Next

and it gives different results run under 3.3.8.1 and 3.3.10.2 as attached

Is this a bug that still exists? Sorry if this is the wrong place for the question but I thought it would be good to continue the thread.

So basically the error results in 3.3.10.2 but not in 3.3.8.1 it shows $I instead.

post-84035-0-34642300-1395322872_thumb.p

Edited by Graeme
Posted

In fact the Jos remark is still valid the socket is not ready.

The only think you can contest is that -1 in the doc means invalid socket array which is not the reality

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...