MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

socket problem

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework
Author Message
n30 [Dzej O.]



Joined: 10 Feb 2008
Posts: 3

PostPosted: Sun Feb 10, 2008 5:15 pm    Post subject: socket problem Reply with quote

Hi
I ve got small problem with the "connect"
I made a application waiting for a connection and for a data.
And I written in VS 2005 ap rogram w pocket pc.
Program is working good on the Pc. The problem is that is crashing down
on the pocket.
I tried to use 2 difrent ways to connect:

TcpClient klient = new TcpClient();
klient.Connect(IPAddress.Parse("192.168.1.19"),
int.Parse("6667"));
NetworkStream stream = klient.GetStream();
BinaryWriter w = new BinaryWriter(stream);
w.Write("MSG!");

********************************************************
And:

********************************************************
Socket s = null;
IPEndPoint ipe = new
IPEndPoint(IPAddress.Parse("192.168.1.19"), int.Parse("6667"));
Socket tempSocket = new Socket(ipe.AddressFamily,
SocketType.Stream, ProtocolType.Tcp);

tempSocket.Connect(ipe);

if (tempSocket.Connected)
{
s = tempSocket;
}

string Data_to_send = "MSG!!";
Byte[] bytesSent = Encoding.ASCII.GetBytes(Data_to_send);
s.Send(bytesSent, bytesSent.Length, 0);

*************************************************************
in details after crash on pocket pc in first lines i see problem with
the connect method. Can someone help me?


regards!
Ps. Sorry for language mistakes, EN is not my native.

Archived from group: microsoft>public>dotnet>framework>compactframework
Back to top
View user's profile Send private message
Simon Hart [MVP]



Joined: 03 Oct 2007
Posts: 95

PostPosted: Sun Feb 10, 2008 1:29 pm    Post subject: RE: socket problem Reply with quote

What exception are you getting if you are getting an exception.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"n30 [Dzej O.]" wrote:

> Hi
> I ve got small problem with the "connect"
> I made a application waiting for a connection and for a data.
> And I written in VS 2005 ap rogram w pocket pc.
> Program is working good on the Pc. The problem is that is crashing down
> on the pocket.
> I tried to use 2 difrent ways to connect:
>
> TcpClient klient = new TcpClient();
> klient.Connect(IPAddress.Parse("192.168.1.19"),
> int.Parse("6667"));
> NetworkStream stream = klient.GetStream();
> BinaryWriter w = new BinaryWriter(stream);
> w.Write("MSG!");
>
> ********************************************************
> And:
>
> ********************************************************
> Socket s = null;
> IPEndPoint ipe = new
> IPEndPoint(IPAddress.Parse("192.168.1.19"), int.Parse("6667"));
> Socket tempSocket = new Socket(ipe.AddressFamily,
> SocketType.Stream, ProtocolType.Tcp);
>
> tempSocket.Connect(ipe);
>
> if (tempSocket.Connected)
> {
> s = tempSocket;
> }
>
> string Data_to_send = "MSG!!";
> Byte[] bytesSent = Encoding.ASCII.GetBytes(Data_to_send);
> s.Send(bytesSent, bytesSent.Length, 0);
>
> *************************************************************
> in details after crash on pocket pc in first lines i see problem with
> the connect method. Can someone help me?
>
>
> regards!
> Ps. Sorry for language mistakes, EN is not my native.
>
>
Back to top
View user's profile Send private message
n30 [Dzej O.]



Joined: 10 Feb 2008
Posts: 3

PostPosted: Mon Feb 11, 2008 5:04 am    Post subject: Re: socket problem Reply with quote

Simon Hart [MVP] pisze:
> What exception are you getting if you are getting an exception.


In translation from my native:

Error msg cannot be displayed becouse there is no resources with that msg.


in:
Syste.net.socket.nocheck()

in:
Syste.net.socket.connect()


....

in DeviceApplication1.Program.Main()

....


I belive that problem is in compact framework on the pocket pc.
tha package propably do not have the connect method.
B ut this theory is failing when i delete the code from line with
connect method.
So class Socket is impleted to the CF, and I don't beleive that someone
putted Socket class without connect method...


Regards.

Ps. Sorry for Language mistakes.
Back to top
View user's profile Send private message
Simon Hart [MVP]



Joined: 03 Oct 2007
Posts: 95

PostPosted: Mon Feb 11, 2008 8:20 am    Post subject: Re: socket problem Reply with quote

Try installing the System_SR cab file (if using CF 2.0 or <) so you can see
the exception.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"n30 [Dzej O.]" wrote:

> Simon Hart [MVP] pisze:
> > What exception are you getting if you are getting an exception.
>
>
> In translation from my native:
>
> Error msg cannot be displayed becouse there is no resources with that msg.
>
>
> in:
> Syste.net.socket.nocheck()
>
> in:
> Syste.net.socket.connect()
>
>
> ....
>
> in DeviceApplication1.Program.Main()
>
> ....
>
>
> I belive that problem is in compact framework on the pocket pc.
> tha package propably do not have the connect method.
> B ut this theory is failing when i delete the code from line with
> connect method.
> So class Socket is impleted to the CF, and I don't beleive that someone
> putted Socket class without connect method...
>
>
> Regards.
>
> Ps. Sorry for Language mistakes.
>
Back to top
View user's profile Send private message
n30 [Dzej O.]



Joined: 10 Feb 2008
Posts: 3

PostPosted: Tue Feb 12, 2008 2:32 am    Post subject: Re: socket problem Reply with quote

Peter Foot pisze:
> connect is definitely implemented in Socket. You need to determine the
> type of the exception that occurs, the fact that there isn't a message
> isn't the root issue. Can you check (e.g. with Internet Explorer Mobile)
> that you have network connectivity and that you can reach this
> particular host, also make sure you don't have any firewalls etc in
> between. If you are testing this through an ActiveSync passthrough
> connection you'll probably find this is not letting traffic through on
> that port, you should try on a direct e.g. WiFi network.

Thx your advice solved problem out!
I used the connecion form active sync.
When I enabled Wifi network thep roblem is gone!

Thx a milion!
Regards!

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
setting a socket receive buffer size not supported on ppc2k2 Hi I use the following line in my code to increase the socket buffer size to ensure that packets sent from a server won't be dropped because the buffer fills up and the application isn't emptying the receive buffer fast enough.

InvokeMember() problem Hello, I try to call an object's member function by function. It works perfectly under .NET Framework but throws an under the .NET Compact Framework. Please take a look at the following code snippet: public class

Problem with wceload.exe Hello, i want to install automatical a cab-file without the user have to choose the destination folder. i use the following code: but the option /noaskdest is ignore

SQL Server CE problem Hi, the following code always throws the exception. Why? It should simply create the table with the two rows: If Not Then Dim sqlEngine As New Source = \Program

Problem opening several modal forms Hello My application opens several modal forms (the modal Form1 opens the modal Form2 that opens the modal Form3 and so on), but, the third and the successives modal forms.... are not modal!!! Seems that there's a maximum number of modal forms, is it poss
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group