+ Reply to Thread
Results 1 to 5 of 5
.net application to establish gprs connection
This is a discussion on .net application to establish gprs connection within the M8 Applications forums, part of the Meizu M8 category; it is still not possible to make a gprs connection with mobilkom austria (A1). I got the networktrace from mobilkom ...
-
09-16-2009 #1Member
- Join Date
- Aug 2009
- Location
- Austria
- Posts
- 222
- Thanks
- 44
Thanked 10 Times in 10 Posts.net application to establish gprs connection
it is still not possible to make a gprs connection with mobilkom austria (A1).
I got the networktrace from mobilkom and can see that there is a problem with the autentification (i filled in correct data but they are transmitted incorrect). perhaps a problem with the char set (there is an @ in the username).
now i found this link:
Establishing GPRS connection in C# (RAS,RasDial)
i do not have visual studio because its very expensiv. with the express version it is not possible to make mobile apps.
is anybody able to test the source from the link above?
-
09-17-2009 #2Member
- Join Date
- Aug 2009
- Location
- Austria
- Posts
- 222
- Thanks
- 44
Thanked 10 Times in 10 Postsi downloaded the 30day trial of visual studio. this should be enouth for this tool (i hope).
with this code i got error 608 Das Gerät ist nicht vorhanden (The device is not available) in line
r = RasDial(IntPtr.Zero, IntPtr.Zero, (IntPtr)pAddr, 0, IntPtr.Zero, ref
RasConn);
.
is anybody able to help me?
Code:namespace GRPSConnect { public partial class Form1 : Form { unsafe public static uint myRasDial(string EntryName, string UserName, string Password, out IntPtr RasConn) { /* EntryName ,UserName,Password - same as in RASDIALPARAMS structure (see MSDN) */ // MessageBox.Show("Starte verbindung"); uint r = 0; RasConn = IntPtr.Zero; String test = ""; byte[] bRASDIALPARAMS = new byte[1464]; fixed (byte* pAddr = bRASDIALPARAMS) { test = test + pAddr[0]; byte* pCurrent = pAddr; // MessageBox.Show(test); System.Runtime.InteropServices.Marshal.WriteInt32((IntPtr)pCurrent, bRASDIALPARAMS.Length); pCurrent += 4; foreach (byte b in Encoding.Unicode.GetBytes(EntryName)) { System.Runtime.InteropServices.Marshal.WriteByte((IntPtr)pCurrent, b); test = test + b.ToString(); pCurrent++; } pCurrent = pAddr + 0x192;//0x192 - offset for RASDIALPARAMS.UserName test = test + "::"; foreach (byte b in Encoding.Unicode.GetBytes(UserName)) { System.Runtime.InteropServices.Marshal.WriteByte((IntPtr)pCurrent, b); test = test + b.ToString(); pCurrent++; } pCurrent = pAddr + 0x394;//0x394 - offset for RASDIALPARAMS.Password foreach (byte b in Encoding.Unicode.GetBytes(Password)) { System.Runtime.InteropServices.Marshal.WriteByte((IntPtr)pCurrent, b); test = test + b.ToString(); pCurrent++; } // MessageBox.Show(test); r = RasDial(IntPtr.Zero, IntPtr.Zero, (IntPtr)pAddr, 0, IntPtr.Zero, ref RasConn); MessageBox.Show(r.ToString()); //608 } return r; } [System.Runtime.InteropServices.DllImport("coredll.dll")] public static extern uint RasDial(IntPtr dialExtensions, IntPtr phoneBookPath, IntPtr rasDialParam, uint NotifierType, IntPtr notifier, ref IntPtr pRasConn); [System.Runtime.InteropServices.DllImport("coredll.dll")] public static extern uint RasHangUp(IntPtr pRasConn); public Form1() { InitializeComponent(); IntPtr rc; // connection handle if (myRasDial("a1.net", "ppp@a1plus.at", "ppp", out rc) == 0) { //success try { System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient("www.google.at", 80); MessageBox.Show("OK"); //.................................. } catch (Exception ex) { MessageBox.Show(ex.Message); } RasHangUp(rc); } else MessageBox.Show("Error"); } } }
-
02-22-2010 #3Member
- Join Date
- Aug 2009
- Location
- Austria
- Posts
- 222
- Thanks
- 44
Thanked 10 Times in 10 Postsgoogle talked to me again:
to search for gprs/edge does not bring many success.
RAS is the keyword.
there should be a rnaapp
in the windows folder.
but i can not find it.
The Remote Network Access (RNA) Dialer :: Chapter 6. Remote Access Service :: Pocket pc network programming :: Programming :: eTutorials.org
i found this key in the registry:
[HKEY_LOCAL_MACHINE\Comm\Autoras]
"Dialer"="rnaapp.exe"
"NoPromptOpt"="-p"
"RasEntryOpt"="-e"
where can i find this file?
-
02-22-2010 #4Member
- Join Date
- Aug 2009
- Location
- Austria
- Posts
- 222
- Thanks
- 44
Thanked 10 Times in 10 Postsi found the file. its there but hidden.
but i only can establish connections which are declared in settings=>gprs
-
02-25-2010 #5Member
- Join Date
- Aug 2009
- Location
- Austria
- Posts
- 222
- Thanks
- 44
Thanked 10 Times in 10 Postsi am now able to read the ras-book from the registry. i can copy entrys and edit them. but i am not able to connect.
here is my code:
but i get "Could not connect using RAS. Error 260" when i try to connect.BOOL MakeRasDial (HWND hDlgWnd)
{
BOOL bPassword;
DWORD dwError;
TCHAR szBuffer[100];
// Set hRasConn to NULL before attempting to connect.
hRasConn = NULL;
// Initialize the structure.
memset(&RasDialParams, 0, sizeof(RASDIALPARAMS));
RasDialParams.dwSize = sizeof(RASDIALPARAMS);
// RasDialParams.szPhoneNumber[0] = TEXT('\0');
// RasDialParams.szCallbackNumber[0] = TEXT('\0');
wsprintf(RasDialParams.szEntryName, TEXT("Desktop @ 115200"));
wsprintf(RasDialParams.szUserName, TEXT("ppp@A1plus.at"));
wsprintf(RasDialParams.szPassword, TEXT("ppp"));
wsprintf(RasDialParams.szDomain, TEXT("a1.net"));
// Try to establish a RAS connection.
if ((dwError = RasDial (
NULL, // Extension is not supported in Windows CE
NULL, // Phone book is in the registry
&RasDialParams, // RAS configuration for the connection
0xFFFFFFFF, // Must use this value for Windows CE
hDlgWnd, // Window receives the notification message
&hRasConn)) != 0) // Connection handle
{
printf("Could not connect using RAS. Error %x",dwError);
wsprintf (szBuffer, TEXT("Could not connect using RAS. Error %x"),
dwError);
MessageBox (hDlgWnd, szBuffer, szTitle, MB_OK);
return FALSE;
}
wsprintf (szBuffer, TEXT("Dialing %s..."), szRasEntryName);
// Set the dialing dialog box window name to szBuffer.
SetWindowText (hDlgWnd, szBuffer);
return TRUE;
}
i do not find anyrhing about ras error 260 with google.
any ideas?
Similar Threads
-
0.9.2.6 and T mobile GPRS connection?
By acidrain in forum M8 FirmwareReplies: 6Last Post: 08-12-2009, 03:39 AM -
[BBS] Application package
By jorge_regula in forum M8 ApplicationsReplies: 2Last Post: 04-05-2009, 01:46 PM -
Java Application
By beefaronee in forum M8 ApplicationsReplies: 2Last Post: 03-24-2009, 09:45 PM -
GPRS Internet Connection =(
By wpeters9 in forum General Meizu M8Replies: 8Last Post: 03-05-2009, 07:58 PM -
M8 (MiniOne) Patent Application
By Russarch in forum General Meizu M8Replies: 7Last Post: 01-21-2008, 03:13 PM



Reply With Quote