w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Execute a ping to an address using Lua io.popen, non blocking if ping times out
io.popen is not going to work with copas. Copas is for sockets, not pipes. The quickest solution is to use polling; do e.g.: local socket = require "socket" local waitTime, sleepTime = 5, 0.1 local endT = os.time() + waitTime local result os.capture("ping myknowngoodip -c 1 > myoutfile") while os.time() <= endT do local pcall_ok, fHand = pcall(io.open, "myoutfile", "r") if pcall_ok then result = assert(fHand:read("*all")) assert(fHand:close()) end socket.sleep(sleepTime) end if result then -- Success! else -- Error :( end Another possibility is a separate thread; LuaLanes is the best multithreading toolkit out there, but also the biggest in terms of memory consumption. This is somewhat more involved, however. Another option is to implement

Categories : Lua

How to ping, get the ping number, and put it in a label
Your two examples are identical.. except that Dispose() is called when using using.. whereas, it isn't in the second example. Since the Ping object is being re-used.. it is definitely a good idea to scope it much wider than you are (in what I assume is some sort of Timer). So there is no real case not to move it into a wider scope (class level perhaps).

Categories : C#

ICMP Checksum error
solved it by removing pseudo header and calculating icmp header and icmp data only ICMP_HEADER *icmpheader = new ICMP_HEADER; memcpy(icmpheader,ICMPHeader,sizeof(ICMP_HEADER)); icmpheader->Checksum = 0x0000; UINT packet_size = sizeof(ICMP_HEADER) + ICMPDataSize; packet_size = packet_size + ((packet_size%2)*2); UCHAR *icmppacket = (UCHAR*)malloc(packet_size); memset(icmppacket,0, packet_size); memcpy(icmppacket, icmpheader,sizeof(ICMP_HEADER)); memcpy(&icmppacket[sizeof(ICMP_HEADER)],ICMPData,ICMPDataSize); if (GlobalChecksum((USHORT*)icmppacket,packet_size) != ICMPHeader->Checksum) { isMalformed = true; PacketError = PACKET_ICMP_CHECKSUM; }

Categories : C++

C++ - Access violation when constructing ICMP packet
Your ipChecksum function expects a pointer to the data it's supposed to checksum, not a pointer to a structure that contains a pointer to the data to checksum. So first it checksums icmpHead, which is good. But then it checksums the pointer to data, which makes no sense. And then it checksums off the end of the EchoRequest structure.

Categories : C++

Filtering ethernet packets (ICMP, Bonjour) on a TAP interface on OSX
One possibility is to use the built-in ipfw firewall in OSX. From the terminal, we could allow only tcp traffic on a virtual network interface called tap1: sudo ipfw add 9000 allow tcp from any to any via tap1 # allow tcp sudo ipfw add 9001 deny ip from any to any via tap1 # block all other incoming and outboung traffic And we can also delete the rules if we don't need them: sudo ipfw del 9000 9001 Alternatively, it is possible to just parse the ethernet frame and convert it from ascii into hex or decimal, and then decide what to do with it there. You can very easily detect TCP/UDP packets with the below (protocol=6 for tcp, and 17 for udp). from binascii import hexlify ... # given some ethernet frame string data protocol = int(hexlify(frame[23:24]), 16) src_port = int(hexlify(frame

Categories : Networking

wireshark doesn't display icmp traffic between tow logical interafce
Is there a problem in wireshark with logical interface? Probably not. You'll probably see the same problem with tcpdump, netsniff-ng, or anything else that uses PF_PACKET sockets for sniffing on Linux (Linux in general, not just Ubuntu in particular, or even Ubuntu, Debian, and other Debian-derived distributions). Given that those are two logical interfaces on the same machine, traffic between them will not go onto the Ethernet - no Ethernet adapters I know of will receive packets that they transmit, so if the packet were sent on the Ethernet the host wouldn't see it, and there wouldn't be any point in wasting network bandwidth by putting that traffic on the network even if the Ethernet adapter would see its own traffic. So if you're capturing on eth0, you might not see the traffic.

Categories : Linux

How do I calculate the frequency of ICMP requests being received by a Linux machine?
You could wrap tcpdump in a script, no files involved. Note the -l option to tcpdump, which says do line buffering. If you leave it out you'll get buffered output which isn't likely what you want. sout = IO.popen("sudo tcpdump -l -i any icmp[0]==8 2>&1") line = sout.gets while (!line.nil?) p line #fiddle with line and do time line = sout.gets end

Categories : Ruby

Arduino udp ping
I don't know your network stack, but ES_packetloop_icmp_tcp does not sound like it will work on UDP traffic. I'd assume it processes ICMP and/or TCP packets. ICMP is the type of packets used by the common ping command and ICMP is not the same as UDP. Edit: Maybe this helps to get you started.

Categories : C#

Ping only working one way
After @Ernest Friedman-Hill brought to my attention the issues might have to do with the firewall, silly me, I created a new incoming rule in the advanced settings section of the Windows firewall for the TCP port I'm using in the application. It all works like a charm now.

Categories : Android

Nginx can ping itself but cannot connect from anywhere else
To connect using the IP address add the IP to the server name server_name server.com; Then restart nginx and it should work if you access from inside the local network.

Categories : Nginx

How check if succesfull cmd ping in php
This should do it: if(exec('ping http://www.google.com')) { echo 'True'; } else { echo 'False'; } I suggest you could use CUrl See Manual but that all depends upon what you are trying to achieve. Provide more data if needed. NOTE You are to use http:// before google.com as that's needed in order to make the ping.

Categories : PHP

How can I wake a Heroku app with a ping from JS?
Here is possible solution: https://coderwall.com/p/u0x3nw As answers containing only a link are not welcome here, I'll just duplicate link contents. A common way to work around Heroku's idling policy is to set up a script to send a ping once an hour to keep the dyno alive. You can use the following to add New Relic's free plan to your account. $ heroku addons:add newrelic:standard Open the New Relic interface: $ heroku addons:open newrelic Under Menu, inside the Reports section, find Availability. Add your URL, set a ping time of < 1 hour, and you're all set to go. Using Scheduler Alternatively, if you don't like or want to use New Relic, you can actually set up a keep-alive dyno ping through Heroku itself, using the Heroku Scheduler. For instance, if you're using Ruby, y

Categories : Javascript

PhoneGap Website Ping
If you're able to run something like node.js + socket.io on your server, then you could use that to mimic ping: https://github.com/guille/latency-io You could also do a XMLHttpRequest (or jQuery.get()) and calc the time difference between request and response. But that won't be very accurate. I.e.: How to ping in JavaScript or jQuery? You can't really do a real ping, the Phonegap API doesn't allow you to do such things out of the box. You could build a plugin to do such things, but then you have to write that native plugin for every platform (i.e. http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-android.html).

Categories : Cordova

PHP server ping seeming to cause 502 error
To fully analyze your issue, you will need a tool like http://en.wikipedia.org/wiki/Wireshark and follow why the 502 happens. This script already contains an 'offline detection'. I don't think its an issue with offline/online.

Categories : PHP

Android SDK ping has encountered
Finally I solved the issue by updating hosts file.C:WindowsSystem32Driversetc, in last line I updated dl-ssl.google.com, and second thing I change the windows language Hindi to english.

Categories : Android

ping with tcpflow and tcpdump
When I use tcpflow icmp and ping I have no answer Uh... How about this: tcpflow captures data from TCP connections and ICMP messages (e.g., pings & etc) are not part of TCP connections.

Categories : Networking

How to ping the server in Android?
See this method, it's the best way to check for connectivity to a given server: http://developer.android.com/reference/java/net/InetAddress.html#isReachable(int)

Categories : Android

AnyEvent fork_call and ping
You need to wait for the pings to finish ($cv->recv;) before you can print their output. my $ping_data = fork_ping(); $cv->recv; p $ping_data; (You could also place the $cv->recv; inside of fork_ping.)

Categories : Perl

How to make ping website ip using PHP?
Depending on the permissions in php, you might be able to <?php system("ping -c 3 localhost"); ?> Be very careful accepting hostnames from web forms - if a user requests that you ping the server "; rm -rf /", you will lose all your data!

Categories : Misc

Ping timeout issues
You can use -w to specify timeout ping -c1 -w1 Options Details: -c count Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires. -w deadline Specify a timeout, in seconds, before ping exits regardless of how many pack‐ ets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.

Categories : Linux

Default ping timeout
From MSDN here and here The method waits five seconds for an ICMP echo reply message. If it does not receive a reply in that time, the method returns and the Status property is set to TimedOut. And if we check in reflector, indeed we see: public PingReply Send(string hostNameOrAddress) { return this.Send(hostNameOrAddress, 5000, this.DefaultSendBuffer, null); }

Categories : C#

AFNetworking sending NSDictionary as single array values instead of sending them as complete objects
I think the issue comes about because you're using a default HTTP POST with arguments to send your value. You can confirm this by printing out the content-type of the post on the server side; it should be something along the lines of x-www-form-urlencoded. If that's the case, that data format can't really express arrays and dictionaries well. So you get the odd format you're seeing on the server side. What you probably want to do is send your data as JSON, not as plain form parameters. I believe the thing you want to do is set the parameterEncoding property of your AFHTTPClient to AFJSONParameterEncoding. This will send your request as JSON, which is capable of representing arrays and dictionaries correctly on the wire.

Categories : IOS

Sending data to google wallet it is sending response merchant error
The demo sample you are pointing to seems to work fine. You can also try some additional sample code in various languages (Java, Python, PHP): https://developers.google.com/commerce/wallet/digital/docs/samples MERCHANT_ERROR implies that something is wrong with the purchase request such as a badly formatted JWT. If you are trying to re-use the sample code in your app make sure to generate a new JWT using your Seller ID and Seller Secret.

Categories : Android

Android Email sending failed with error Fail to send: IOException while sending message
Try public final static String APP_PATH_SD_CARD = "/Images_Book/filetobeattached.ext"; Instead of public final static String APP_PATH_SD_CARD = "/Images_Book/";

Categories : Android

Error while sending attachments via Openerp 7 'Social Network' app but works fine while sending normal message
It's a bug. The reason being that context is not passed correctly when you click on the "Compose New Message" button or other send message buttons. The bug has been reported. They should be working on it by now.

Categories : Python

Sending email through MS Access VBA / Outlook, choosing sending profile
You need to log to the specified profile. After creating an instance of the Outlook application Set oApp = CreateObject("Outlook.application") add something like the following: set oNS = oApp.GetNamespace.Logon oNS.Logon("MyProfileName") Note if Outlook is already running, Logon will do nothing. You will need to use Extended MAPI (C++ or Delphi or a MAPI wrapper like Redemption (RDOSession.Logon) to log to a specified profile. Why not work with a single profile and create multiple accpunts? You can then set the MailItem.SendUsaingAccount property to specify a particular account.

Categories : Vba

Heroku app idles even though I am using new relic to ping
You have a few ways to achieve that: Pay. Buy an extra web dyno and your app will never idle out. Use Uptime Robot (not sure about the sessions issue here)

Categories : Ruby On Rails

Ping a server + progress bar then display a different div
i am going to demonstrate to you how its done with just jquery, i haven't used bootstrap much. first let's assume we have server code that does similar to what your doing. $json = array(); if ($socket = fsockopen($_POST['ip'], 80, $errno, $errstr, 30)) { $json = array('status' => 1); fclose($socket); } else { $json = array('status' => 0); } header("Content-Type: application/json"); echo json_encode($json); We have a server script that we can call from the client end that will return us a json response. On the html side we have the following progress bar. <progress id='progress' max=100></progress> Then we have the following jquery code that calls our script $(function () { var options = { url: '/script.php', data: { ip : '127.0.

Categories : PHP

Unable to connect to VM (RDP, Telnet, Ping)
I had a similar issue with MySQL server installed on VM, and endpoint TCP on port 3306 was defined exactly according to the guides, however couldn't connect from remote places not by MySQL or telnet. I look for day's until I've checked - Control PanelSystem and SecurityWindows FirewallAllowed Programs in the VM, and saw that for the program MySQL56 the public check-box was unchecked. checked it, and connection has open.

Categories : Azure

How to parse a ping result with regex
Description This expression will capture IP, bytes of data, bytes, ICMP_SEQ, ttl, time. I couldn't find etc. ^PING # match ping [^(]*(([^)]*)) # capture IP s([^.]*). # capture the bytes of data .*?^(d+sbytes) # capture bytes .*?icmp_seq=(d+) # capture icmp_seq .*?ttl=(d+) # capture ttl .*?time=(.*?ms) # capture time .*?(d+)spacketsstransmitted # the rest of these lines will capture the other portions of the ping result .*?(d+)sreceived .*?(d+%)spacketsloss .*?times(d+ms) .*?=s([^/]*)/([^/]*)/([^/]*)/(.*)sms Example Live Example: http://www.rubular.com/r/uEDoEZwY7U Sample Text PING google.com ( 56(84) bytes of data. 64 bytes from mil01s16-in-f9.1e100.net ( icmp_seq=1 ttl=52 time=33.0 ms --- google.com ping statistics --- 1 packets transmitted, 1 r

Categories : Java

You have the problem when you are doing the SET. the SET for "RGWsn" and "EndianIP" is fine, but at other places, the spaces are causing the problem. SET IP01 = 10.128.%RGWsn%.0 With this you are creating a variable "IP01 " and setting its value to " 10.128.%RGWsn%.0" Notice the spaces here. You should be doing SET IP01=10.128.%RGWsn%.0 Similarly for IP02 and IP03. Take a look at this similar problem.

Categories : Windows

Measuring packet loss of ping- c++
You can use the POCO library it's small (ALOT smaller than boost) and more readable than ACE when it comes to networking. Here's the source of a ping program using the ICMPClient You will find it under POCO_BASE/net/examples/Ping/src #include "Poco/Util/Application.h" #include "Poco/Util/Option.h" #include "Poco/Util/OptionSet.h" #include "Poco/Util/HelpFormatter.h" #include "Poco/Util/AbstractConfiguration.h" #include "Poco/Net/ICMPSocket.h" #include "Poco/Net/ICMPClient.h" #include "Poco/Net/IPAddress.h" #include "Poco/Net/ICMPEventArgs.h" #include "Poco/AutoPtr.h" #include "Poco/NumberParser.h" #include "Poco/Delegate.h" #include <iostream> #include <sstream> using Poco::Util::Application; using Poco::Util::Option; using Poco::Util::OptionSet; using Poco::Util::HelpForma

Categories : C++

Ping Servers From Text File
You can write a VB script to do this. Set objFS = CreateObject("Scripting.FileSystemObject") strFile = "c: estipList.txt" strTemp = "c: estip_testOP.txt" Set objFile = objFS.OpenTextFile(strFile) Set objOutFile = objFS.CreateTextFile(strTemp,True) Do Until objFile.AtEndOfStream strLine = objFile.ReadLine objOutFile.Writeln(Ping(strLine)) Loop objOutFile.Close objFile.Close objFS.DeleteFile(strFile) objFS.MoveFile strTemp,strFile Function Ping(strHost) Dim oPing, oRetStatus, bReturn Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address='" & strHost & "'") For Each oRetStatus In oPing If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then bReturn =

Categories : File

mysqladmin ping error code
It's not a bug. This behavior is by design. ping Check whether the server is available. The return status from mysqladmin is 0 if the server is running, 1 if it is not. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running.

Categories : Mysql

Server high ping with Node.JS
The most common problem is when someone connects, your logic in node.js blocks and holds execution cursor, and then releases it after some delay that involves every other callback to wait. As node is async and single threaded process, you should avoid any blocking operations as much as possible. Use async operations with MySQL, and make sure all your internal logic is not blocking. Although more information regarding your logic would be helpful.

Categories : Node Js

Bash ping status script
There is a good point in the comments that you might want to use an infinite loop. But as you have asked for something different, here you go: HOSTS="ns1.server.com ns2.server.com" SUBJECT="Host Down" PATH_STATUS='/yourfolder/hoststatus_' # For example can be located in /tmp. for myHost in $HOSTS; do count=$(ping -c 10 "$myHost" | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') [[ -f "$PATH_STATUS$myHost"]] && prevStatus=$(cat "$PATH_STATUS$myHost") || prevStatus='unknown' [[ $count == 0 ]] && curStatus='down' || curStatus='up' if [[ $curStatus != $prevStatus ]]; then echo "$curStatus" > "$PATH_STATUS$myHost" echo "Host : $myHost is $curStatus at $(date)" | sendEmail fi done

Categories : Bash

Android how ping test Work?
Use: Jpingy library. Example: PingArguments arguments = new PingArguments.Builder().url("google.com").timeout(5000).repeat(2).bytes(32).build(); PingResults results = Ping.ping(arguments,Backend.UNIX);

Categories : Java

Ping list of ip addresses using Javascript
You can't directly "ping" in JavaScript. There may be a few other ways: Ajax Using a Java applet with isReachable Writing a server-side script which pings, and using AJAX to communicate to your server-side script You might also be able to ping in Flash (using ActionScript) There are also some methods for pinging in JavaScript described in this question: Is it possible to ping a server from Javascript?

Categories : Javascript

Can i ping a list of sites in a certain order?
You are calling Ping.SendAsync(), which is an asynchronous method, for each IP address so the responses will not necessarily return in the same order that they were sent. Can you use the Ping.Send() method instead?

Categories : Asp Net

Serial port ping functionality
It just isn't quite the same problem as having to use Ping to find if a server that's located a thousand miles away is online. With serial ports you just look at the other end of the cable, you rarely have to walk more than a few feet. There's also nothing similar to having a stateful connection like TCP. All you can really do is look at the hardware handshake signals. The SerialPort.DsrHolding gives you the state of the Data Set Ready signal. A properly implemented serial device uses that signal to say that it is powered-on. CtsHolding is an additional signal, it says that it is ready for you to send data. They normally have to be both turned on before you consider sending anything. These handshake signals are not always properly implemented. You may well have a problem if the se

Categories : C#

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.