Jump to content
Sign in to follow this  
glarson

eve online - check connection

Recommended Posts

glarson

I would like to write a script that would check to see if EVE online is connected to the internet and detect when the program disconnects. i have seen some posts that use dllcall to check to see if they are connected to the internet. Does anyone know what dll you need to call to monitor EVE's connection?

This is the script I found.

CODE
$state=-1

While 1

If _IsCon()<>$state Then

If _IsCon()=0 Then

TrayTip("Internet Connection","Disconnected",2,2)

$state=0

Else

TrayTip("Internet Connection","Connected",2,1)

$state=1

EndIf

Else

EndIf

WEnd

Func _IsCon()

$IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)

Return $iscon[0]

EndFunc

will "InternetCheckConnection" work better then "InternetGetConnectedState"?

Share this post


Link to post
Share on other sites
Uten

I don't understand the question.

Do you want to:

A: Detect if "EVE online" (the server or something) is connected to the Internet?

B: Detect if your local client is connected to the server?

C: Detect if you have an Internet connection at all?

Share this post


Link to post
Share on other sites
murdock

That script you found was a little confusing to read so I rewrote it:

While _IsCon()
    TrayTip("Internet Connection","Connected",2,1)
    Sleep(500)
WEnd
MsgBox(0, "Internet Connection", "Disconnected")

Func _IsCon()
    Local $inetTest = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)
    Return $inetTest[0]
EndFunc

Share this post


Link to post
Share on other sites
glarson

I don't understand the question.

Do you want to:

A: Detect if "EVE online" (the server or something) is connected to the Internet?

B: Detect if your local client is connected to the server?

C: Detect if you have an Internet connection at all?

A: I want to detect if EVE Online is connected to the internet.

Edited by glarson

Share this post


Link to post
Share on other sites
murdock

glarson you can't check if EVE is connected to the internet through your own machines DLLCalls... maybe if you ping the server IP, or if theres a login screen that displays "Offline - Online"?

However I think you actually want to know if your client (your computer) is connecting to the server (EVE Online)..?

Share this post


Link to post
Share on other sites
Uten

Use netstat -a and filter against the port your even online client is supposed to use?

EDIT: Obviously a ping does not hurt either. But that might not tell you if the game server is online.

Edited by Uten

Share this post


Link to post
Share on other sites
glarson

Use netstat -a and filter against the port your even online client is supposed to use?

Uten - I'm not familiar with netsat. what is it?

murdock: There is an 'failed connection' screen that comes up when your connection is disabled or lost. your right, what I want to know is if my client is connected to the EVE online server. Can you do that without looking for a screen to appear(lost connection)? I want to do it without mousemovements or pixel searches.

Share this post


Link to post
Share on other sites
wolf9228

#include <Array.au3>
#include <Constants.au3>
$foo =  Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)
$line = StdoutRead($foo)
$avArray = StringSplit($line, @LF)
_ArrayDisplay($avArray, "_ArrayDisplay() Test")


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites
glarson

Thanks wolf9228!

Now how would you search for a spacific 'Foreign Address' in the array that is made?

I tried this approach but the message box would return nothing!

CODE
#include <Array.au3>

#include <Constants.au3>

$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)

$line = StdoutRead($foo)

$avArray = StringSplit($line, @LF)

_ArraySort($avArray,0,1)

_ArrayDisplay($avArray, "_ArrayDisplay() Sorted")

$address=_ArrayBinarySearch($avArray,"TCP Slcnmoodie:1038",0)

MsgBox(0,"address",$address)

I want to be able to check the 'foreign address' part of the array periodically for a specific address (Eve Online Server). If its not found then I want to call a funcrtion to restart the program. Any ideas?

Share this post


Link to post
Share on other sites
Uten

If you start your program from autouit with run you will get the PID. You can use that PID to close/kill the program with ProcessClose. Other vice you culd use ProcessList to get the pid of your client. Close it and start it again with Run. You should probably make sure it is really terminated before you start it again.

Share this post


Link to post
Share on other sites
Blue_Drache

If you start your program from autouit with run you will get the PID. You can use that PID to close/kill the program with ProcessClose. Other vice you culd use ProcessList to get the pid of your client. Close it and start it again with Run. You should probably make sure it is really terminated before you start it again.

Eek... I was going to say something about getting the windows handle from the PID, but that doesn't appear possible. Umm... Hmm.

ProcessWait() - wait until process exists

ProcessExists() - check to see if process exists.

ProcessWaitClose() - wait until process exits.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
Uten

Not a bad suggestion @blue_drache, I'm a bit lazy so I chose the brute force path. Sending a close message to that window will enable the application to close gracefully.

You can find the handel of the root window if it does have a window. There are sample code in scripts (if my memory serves me right). But it could have been done by @Larry and therefore gone at the moment. I guess someone have to do a search, if the interest is big enough..:)

Share this post


Link to post
Share on other sites
wolf9228

Thanks wolf9228!

Now how would you search for a spacific 'Foreign Address' in the array that is made?

I tried this approach but the message box would return nothing!

CODE
#include <Array.au3>

#include <Constants.au3>

$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)

$line = StdoutRead($foo)

$avArray = StringSplit($line, @LF)

_ArraySort($avArray,0,1)

_ArrayDisplay($avArray, "_ArrayDisplay() Sorted")

$address=_ArrayBinarySearch($avArray,"TCP Slcnmoodie:1038",0)

MsgBox(0,"address",$address)

I want to be able to check the 'foreign address' part of the array periodically for a specific address (Eve Online Server). If its not found then I want to call a funcrtion to restart the program. Any ideas?
#include <Constants.au3>
$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)
$line = StdoutRead($foo)
if StringInStr($line, "TCP Slcnmoodie:1038") then  MsgBox(0, "Search result:", "the StringInStr")

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites
glarson

wolf9228, I coudn't get your script to work. i may not understand what your script is doing, but it wouldn't return the info I was looking for.

I want to search the array returned by this line:

$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)

for a spacific 'foreign address' to see if I am still connected to the client or not.

example from the array:

[2]| Proto Local Address Foreign Address State

[16]| TCP slcnmoodie:2817 216-129-118-13.cust.layer42.net:http CLOSE_WAIT

I want to check to see if I am still connected to 216-129-118-13.cust.....ect

How can this be done?

Edited by glarson

Share this post


Link to post
Share on other sites
Kurtferro

I think than glarson want know when the game client got disconnection from the server, its sufficient know if the process (exemple eveonline.exe) have internet activity, dont need with who because game client can be connected only with the game server, if he got dc is sufficien monitoring for few minuts if download and upload activity result be null it mean he got disconnection.

but if i understood this code can work because it look if in the netstat list appear the ip, if u arent connected :2817 216-129-118-13.cust.layer42.net:http cant appear in list, because -a option is only for active connection.

#include <Constants.au3>
$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)
$line = StdoutRead($foo)
if StringInStr($line, "TCP Slcnmoodie:1038") then  MsgBox(0, "Search result:", "the StringInStr")
Edited by Kurtferro

Share this post


Link to post
Share on other sites
glarson

I have figured out how to do this. Thanks everyone for the help, you all lead me in the right direction. Here is the code that will create an array with all of your active connections, display it for you, turn the array into a string, then search that string for a specified connection, and tell you if it is there or not.

Enjoy all!! :)

CODE
#include <Array.au3>

#include <Constants.au3>

$foo = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)

$line = StdoutRead($foo)

$avArray = StringSplit($line, @LF)

_ArraySort($avArray,0,1)

_ArrayDisplay($avArray, "_ArrayDisplay() Sorted")

$avstring=_ArrayToString($avArray,@LF)

if StringInStr($avstring, "Proto Local Address Foreign Address State") then

MsgBox(0, "Search result:", "Connection found")

Else

MsgBox(0,"search results","nope")

EndIf

Edited by glarson

Share this post


Link to post
Share on other sites
Blue_Drache

Grats! Welcome to the wonderful world of AutoIt.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
glarson

Grats! Welcome to the wonderful world of AutoIt.

THX :)

Let the good time roll!

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  

×