Closing Sockets

R

Roberto Peña

Hi guys,

I'm developing an application for the windows ce 4.2, I'm using .Net Compact
Framework 2.0 SP2 (manually installed) , I'm comunicating with a server
using a simple WinSocket 2 protocol, it works nice, however I came across
some problems I cant call the Close method on the TcpClient object I'm using
to connect to the server, If I call this method, next time I create a
TcpClient I cant perform a read operation It will wait forever unless I
write more data into the stream; if I dont close the TcpClient object and I
just let it go out of scope it works fine, I'm a little worried about
leaking memory with this beahavior.

Has anyone experienced somthing like this?

A couple of more questions:

1- how do I specify the installation folder for the GAC in the
compactframework cab? it seems it always writes something to the windows
folder and I lost those files everytime I hard reset my device!

2- maybe somebody can tell me how can I force my device to connect to a
wireless network whenever it is on range

Thanks in advance!

-- Roberto
 
P

Paul G. Tobey [eMVP]

If the SSID of the wireless network is in the preferred list, it should
connect whenever it is in range, unless you've set things up so that some
user input from you, like a user name and password, is required. In that
case, I think it should pop up the dialog to enter those.

Paul T.
 
G

Guest

The Close method only releases the managed resources and does not release the
connection, so if you're not calling Close or Dispose then you probebly have
lots of connections that eventually close once the garbage collector comes
along.

Can you post some code showing this problem. Although I have never used
TcpClient, I use Socket end to end, I haven't experienced those issues with
Socket under the same configuration and OS as you are having with TcpClient.
Have you tried using the Socket class?

You can't specify the location of the GAC'ed assemblies, they have to be
installed in \Windows.
 

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