Jump to content

Issues with UDPOpen & UDPRecv


Go to solution Solved by funkey,

Recommended Posts

Hello people.

I am making a communication app which pokes the server for response. And afterwards the communication begins.

So I am using UDPOpen to create a socket to poke, and UDPRecv to listen. The problem is UDPRecv lags behind, since it waits for data for 100ms. I use the first packet arrival time as some sort of ping. So miliseconds are important here.

A similar issue has been solved here.
'?do=embed' frameborder='0' data-embedContent>>

 
My issue is a bit different though. I need to connect via UDPOpen and not to localhost, so I cannot know the local port for the socket.

Here comes the questions;
 
1- From Autoit Help, UDPOpen; "Returns an array : $array[1] contains the real socket"
What does it mean by "real socket"?

2- Is there a way to find out the local port for a socket? If so how?


Note; Server program is not mine, so I cannot change the way it behaves.

Thanks in advance.

Link to comment
Share on other sites

  • Solution

1: The real socket is the socket used for communication. You don't need to know much about it, if you are using AutoIt. For more information read in Wikipedia or some tutorials like this one: http://www.binarytides.com/winsock-socket-programming-tutorial/

2: Try to use my socket UDF:

There is a function called _GetLocalPort($iSocket).

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.

Link to comment
Share on other sites

Thank you guys
 

I will need some time to study and understand your suggestions.

Also, using winsock dll directly can solve my problem, and thanks to funkey I do not have to write an UDF myself.
I consider this solved.

Edited by hiredblade
Link to comment
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
 Share

  • Recently Browsing   0 members

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