Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / March 2008

Tip: Looking for answers? Try searching our database.

Ping OpenNet question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
news.microsoft.com - 18 Feb 2008 20:05 GMT
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 - 19 Feb 2008 00:31 GMT
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.compactframewor
k/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.

> 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
[quoted text clipped - 7 lines]
> TIA
> Harry
news.microsoft.com - 19 Feb 2008 14:08 GMT
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
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.compactframewor
k/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.

On Feb 18, 12:05 pm, "news.microsoft.com" <hssimp...@phgt.net> wrote:
> 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
[quoted text clipped - 9 lines]
> TIA
> Harry
<ctacke/> - 19 Feb 2008 14:26 GMT
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.

Signature

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

[1] www.opennetcf.com/sdf

> Arun,
>
[quoted text clipped - 56 lines]
>> TIA
>> Harry
news.microsoft.com - 19 Feb 2008 19:30 GMT
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

> The OpenNETCF SDF [1] does have Ping capabilities in the
> NetworkInformation namespace. It would work identically to the sample on
[quoted text clipped - 61 lines]
>>> TIA
>>> Harry
Mortimer - 27 Mar 2008 14:50 GMT
> That's what I've used with some success:
> Private Function CheckConnection() As
[quoted text clipped - 88 lines]
> >>> TIA
> >>> Harry
Mortimer - 27 Mar 2008 14:53 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.