Jump to content

GPRS Connection


Guest K2k

Recommended Posts

hello, maybe somebody can help me here...

I'm working on a programm that uploads Data to a Server via GPRS, it works fine but not via GPRS.

When the mobile is connected via wire to the PC then it works (connected to Server via Internet)...

has someone maybe a sample source how a connection could work with GPRS?

I'm using a socket connection with the TCP Protocoltype.

Can someone help me?

thx

K2k

Link to comment
Share on other sites

  • 2 weeks later...
hello, maybe somebody can help me here...

I'm working on a programm that uploads Data to a Server via GPRS, it works fine but not via GPRS.

When the mobile is connected via wire to the PC then it works (connected to Server via Internet)...

has someone maybe a sample source how a connection could work with GPRS?

I'm using a socket connection with the TCP Protocoltype.

Can someone help me?

thx

K2k

<{POST_SNAPBACK}>

To use GPRS maybe look at OpenNetCF

Link to comment
Share on other sites

  • 3 weeks later...
To use GPRS maybe look at  OpenNetCF

<{POST_SNAPBACK}>

thx ;) but that's no help :( sorry...

i know that i should use opennetcf and i use it, but i can't find any way to make this code running without the connection to the internet...

has maybe someone a source or can help me in a different way :D i can't find the reason why it don't work...

thx :)

K2k

Link to comment
Share on other sites

  • 2 weeks later...

you need to specify HTTP://thewebaddress.com or HTTP://IP.Address:port

:o :(

if your server is a webservice (made in ASP.NET) then add a reference to it in your project (assuming your using .NET) and it will automatically connect via GRPS because it knows its a webservice (because of the url)

however if it is not a webservice then you need to specify HTTP:// followed by the web address or IP Address (And port)

Edited by Tech
Link to comment
Share on other sites

you need to specify HTTP://thewebaddress.com or HTTP://IP.Address:port

:o :(

if your server is a webservice (made in ASP.NET) then add a reference to it in your project (assuming your using .NET) and it will automatically connect via GRPS because it knows its a webservice (because of the url)

however if it is not a webservice then you need to specify HTTP:// followed by the web address or IP Address (And port)

<{POST_SNAPBACK}>

Thank your reply~

You mean like this??

private IPAddress serverip = IPAddress.Parse("xxx.xxx.xxx.xxx");

from IPAddress.Parse("xxx.xxx.xxx.xxx")change to IPAddress.Parse("http://xxx.xxx.xxx.xxx")

Or ,How can I change form my code?

private int portNumber = xxxx;

private IPAddress serverip = IPAddress.Parse("xxx.xxx.xxx.xxx");

private void SendData(IPAddress server, Int32 port, string message)

{

try

{

TcpClient TcpClient = new TcpClient();

TcpClient.Connect(server, port);

byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes(message);

NetworkStream stream = TcpClient.GetStream();

stream.Write(sendBytes, 0, sendBytes.Length);

stream.Flush();

stream.Close();

TcpClient.Close();

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

Edited by sp
Link to comment
Share on other sites

  • 1 month later...
Guest mike_nz
thx :D but that's no help :D sorry...

i know that i should use opennetcf and i use it, but i can't find any way to make this code running without the connection to the internet...

has maybe someone a source or can help me in a different way :D i can't find the reason why it don't work...

thx ;)

K2k

<{POST_SNAPBACK}>

Try this code, works for me, checks for an internet connections seems to force the default connection on my pda to fire up ie gprs

Public Function IsConnectionAvailable() As Boolean

        ' Returns True if connection is available 

        ' Replace www.google.com with a site that is guaranteed to be online 

        Dim objUrl As New System.Uri("http://www.google.com/")

        ' Setup WebRequest 

        Dim objWebReq As System.Net.WebRequest

        objWebReq = System.Net.WebRequest.Create(objUrl)

        Dim objResp As System.Net.WebResponse

        Try ' Attempt to get response and return True 

            objResp = objWebReq.GetResponse

            objResp.Close()

            objWebReq = Nothing

            Return True

        Catch ex As Exception ' Error, exit and return False 

            objWebReq = Nothing

            Return False

        End Try

    End Function

PS I seem to be suffering from the same problem, GPRS fires up using the above code but I keep getting host not found errors when trying to connect to the IP address I specify for my TCP socket... this works like a dream across a local network but try it on the internet and it just doesn't want to work, the ip is available as using gprs i can browse a web site on the same ip address.

any ideas or example code would be greatly appreciated.

Edited by mike_nz
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.