Getting sttaus of RAs connection not working

G

Guest

Hi everybody,
Is there someone who can tell me why the RASGetConnectStatus() is not
functioning and how to fixed this? I like to get status of ras in order to
maintain the connection until explicitly close by user. Also, the RasHangUp()
also not working properly. Thanks in Advance.

Code:
private void ReconnectVPNRAS()
{
while (this.CheckRasConnection(this.IDConnexionRAS) == false)
{
string connectName = this.txtIpAddress.Text;
string user = this.txtUsername.Text;
string pass = this.txtPassword.Text;

this.OpenConnection(connectName,user,pass,"");
Thread.Sleep(1000);
}
}

public bool OpenConnection(string pNomConnection,string pUser,string
pPassword,string pDomain)
{
.....

uint res = RasDial(0,null,TabParams,0,0,ref IDConnexionRAS);
.....
}
[\code]


[code]
public bool GetRasConnectStatus(int idConn)
{
uint res = RasAPI.RasGetConnectStatus(idConn, ref status);
if (res == 0)
{
status.rasconnstate = RASCONNSTATE.RASCS_Connected;
return true;
}
else
{
status.rasconnstate = RASCONNSTATE.RASCS_Disconnected;
return false;
}
}

[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
public extern static uint RasGetConnectStatus(
int pRasConn,  // handle to RAS connection of interest
ref RASCONNSTATUS lprasconnstatus
// buffer to receive status data
);
[\code]


den2005
 
G

Guest

Update

Hi everybody,
Unable to resolve the size of RasConnStatus which causing the
RasGetConnectStatus() of code # 632. Is there anyone who can tell me how to
get the correct size (structure) for the RasConstatus? Thanks in Advanced.

den2005
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top