Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ping OpenNet question

258 views
Skip to first unread message

news.microsoft.com

unread,
Feb 18, 2008, 8:05:40 PM2/18/08
to
I need to try to ping a QL220 Plus Zebra printer set up as a wireless
network printer before I try to print to it. I want a quick way to figure
out if the printer at a certain IP is awake or sleeping etc but in any case
try to determine whether I can print to it or not from my MC70 app.
I've looked at the .Net.NetworkInformation.Ping.Send which returns a
PingReply but don't really know how this works and whether this is the best
code for my purposes...
Any suggestions?

TIA
Harry


Arun

unread,
Feb 19, 2008, 12:31:37 AM2/19/08
to
Harry,
Send an simple ICMP request to find out the printer is available for
communication.
You can use IcmpSendEcho
http://msdn2.microsoft.com/en-us/library/ms927415.aspx

I think OpenNetCF also does the same.
Refer here too
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_thread/thread/273197f519fafb47/dc3234d9d6774388?lnk=gst&q=IcmpSendEcho#dc3234d9d6774388

ICMP will not work with ActiveSync, and if you want to validate with
IPAddress and a port number, try with this code

public static bool IsConnectionEstablished(IPAddress ipAddress, int
port)
{
bool connectStatus = false;
Socket m_ClientSocket = null;
try
{
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,
port);
m_ClientSocket = new
Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
m_ClientSocket.Connect(ipEndPoint);

connectStatus = m_ClientSocket.Connected;
}
return connectStatus;
}

Hope this helps,
Cheers,
Arun.

news.microsoft.com

unread,
Feb 19, 2008, 2:08:59 PM2/19/08
to
Arun,

Thanks for the links....is there anything in CF to do this? These look like
CE functions - any managed code for this or wrapped code?

Guess I really just need to see if the printer is available - it'd look like
a network printer weith IP.

thanks
Harry
"Arun" <arunkuma...@gmail.com> wrote in message
news:d40b404c-52bd-4500...@s8g2000prg.googlegroups.com...

<ctacke/>

unread,
Feb 19, 2008, 2:26:01 PM2/19/08
to
The OpenNETCF SDF [1] does have Ping capabilities in the NetworkInformation
namespace. It would work identically to the sample on MSDN that Arun pointed
to.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

[1] www.opennetcf.com/sdf

"news.microsoft.com" <hssi...@phgt.net> wrote in message
news:OWyn6Dwc...@TK2MSFTNGP05.phx.gbl...

news.microsoft.com

unread,
Feb 19, 2008, 7:30:19 PM2/19/08
to
That's what I've used with some success:
Private Function CheckConnection() As
OpenNETCF.Net.NetworkInformation.PingReplyDim conn As New
OpenNETCF.Net.NetworkInformation.Ping

Try

Return conn.Send("192.168.0.100", 10)

Catch ex As Exception

End Try

End Function

Thing is when I execute the call and the printer is turned off, the app just
hangs.....figured the timeout was in milliseconds first yet the param is an
integer.

I want it to quickly check - like a quick ping and then if failed drop and
teturn false quickly - but it just kinda hangs up the first ping if false
and subsequent hits are fast.

that second param, does it control how quickly the PingReply is returned?

Harry

"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:%23nkx3Mw...@TK2MSFTNGP05.phx.gbl...

Mortimer

unread,
Mar 27, 2008, 1:50:02 PM3/27/08
to

Mortimer

unread,
Mar 27, 2008, 1:53:01 PM3/27/08
to
Did you find a solution to this?
I'm trying something similar using an IP camera, and need to ping it to
check if its powered on or off using CF
0 new messages