Does pinging a website increase number of hits? - ruby-on-rails

I recently found the ping command on the mac. I used to it casually ping my rails heroku app. I was wondering if this type of ping, from the terminal, increases the total number of hits the website gets (obviously not unique hits).

ping is a network command not using the port 80 or http protocol.
So there's no way it can count towards a rails application hit.
More info :
http://wiki.answers.com/Q/Which_port_is_used_by_Ping_command

The ping command only pings the host, it is a network tool to check connectivity between machines, it is a different protocol from HTTP, please read this, it may help you understand a bit better what is ping http://en.wikipedia.org/wiki/Ping_%28networking_utility%29 and what is his uses.
Cheers

What Anthony said above is true. Ping uses ICMP which is lower in the stack than an http request going over port 80. Ping only sends a single packet, expecting a single packet in response which is rather small (I think 64bytes round trip).
This can however generate load on the box running your server. So be wary of excess use as you could inadvertently cause a denial of service :)

Related

How do I check why my internet is only half working?

My internet is only working for heavily cached sites. Reddit, Gmail, Facebook, etc. The odd thing is, sites like Reddit make queries to non-reddit sites to import the images and they pop up fine when viewing from there, but when I get sent to out.reddit.com and then if I go elsewhere to other non-heavily cached sites, I get timed out connection error.
I can't even visit SpeedTest.net because it times out. I also can't even post a question on StackExchange because of it. What could possibly be going on and how to I debug?
EDIT: I had an inclination that it had to do with Docker. I removed all traces using a powershell script and through remove programs and still didn't work.
user3654055 are friends IRL and we debugged this in person.
It's always best to start from layer 1 and work our way up.
user3654055's computer could connect to wireless networks. This tells us layers 1 and 2 are working
.
user3654055's computer received a DHCP lease. Further testing of layer 3 showed inconsistent results with pinging local IP addresses.
I ran route print to print all routes. This produced a huge amount of output.
Normal output for a Windows computer connected to a flat LAN should produce perhaps 3 routes.
user3654055 had recently installed Docker and attempted to set up a private
internal network for the containers on their PC.
user3654055 had created two virtual networks (one internal vEthernet switch, one external vEthernet switch), a NAT interface, and bridged the wireless adapter to one of those interfaces and had not set up routing correctly for any traffic.
This produced the above scenario where certain traffic was routed correctly or hit the cache and the page would load, but most traffic was routed incorrectly and resulted in a timeout.
Disabling all the vEthernet switches and the NAT interface and removing the wireless adapter from the bridge let the user use their wireless card again.
The above configuration could work if the user set up routing correctly by hand, but we can save that for a later date.
Sounds like a DNS issue...do you know what you are using as a DNS address? You could try using Google's which is 8.8.8.8 for primary and 8.8.4.4 for secondary. Failing that does it get better following a router reboot?
To debug your internet connection, I would at first check what happens with tracert.
Traceroute command shows you the path taken by your packets and its latency from hop to hop.
From console (linux) or from cmd (windows)
tracert stackoverflow.com
this shows you where you are lagging, the first entry may be your router IP. If the first entry appears with high latency try to reboot your router.
Checking for DNS Issues
Try to use nslookup. This is what you should get:
nslookup stackoverflow.com
Server: UnKnown
Address: 192.168.1.1
Risposta da un server non autorevole: //italian comment
Nome: stackoverflow.com.home
Address: 54.72.52.58
if this fails or replies with high latency try to change your DNS to Google DNS.
Primary DNS: 8.8.8.8
Secondary DNS: 8.8.4.4

local host, port number, and TCP/IP & UDP

I am trying to program a script to interface two applications, so I need to understand a few basic concepts, if someone could please help me grasp them:
When an application's manual says: This app listens to localhost:9763, it means it receives live data from the same machine on port number 9763. Is this correct?
So, if an application's manual says: Listen on UDP port 6004, it means I have to specify localhost:6004 similar to the first point?
Or does the first point (localhost:9763) imply that TCP/IP is being used, but the second point is on UDP?
Generally speaking, if an app says it is listening on a particular port and doesn't specify TCP or UDP, that usually means TCP. If you're not sure, you can probably figure it out based on what that particular app does and how it does it.

What's the upper bound connections of TServerSocket in Delphi? [duplicate]

I'm building a chat server with .NET. I have tried opening about 2000 client connections and my Linksys WRT54GL router (with tomato firmware) drops dead each time. The same thing happens when I have several connections open on my Azureus bit-torrent client.
I have three questions:
Is there a limit on the number of open sockets I can have in Windows Server 2003?
Is the Linksys router the problem? If so is there better hardware recommended?
Is there a way to possibly share sockets so that I can handle more open client connections with fewer resources?
AS I've mentioned before, Raymond Chen has good advice on this sort of question: If you have to ask about OS limits, you're probably doing something wrong. The IP protocol only allows for a maximum of 65535 ports and many of these are reserved and not available for general use. I would suggest that your messaging protocols need to be thought out in more detail so that OS limits are not an issue. I'm sure there are many good resources describing such systems, and there are certainly people here that would have good ideas about it.
EDIT: I'm going to put some thoughts about implementing a scalable chat server.
First off, designate a single port on the server for clients to communicate through. Whenever a client needs to update the chat state (a new user message for example) do the following:
create message packet
open port to server
send packet
close port
The server then does the following:
connection request received
get packet
close connection
process packet
for each client that requires updating
open connection to clients
send update packet
close connection
When a new chat session is started, the client starting the session sends a 'new session' message to the server with the clients user details and IP address for responses. The server creates a new chat session and responds with the session ID. The client then sends packets containing the messages the user types, the server processes them and forwards the message to other clients in the same session. When a client leaves the chat, it sends a 'end session' message to the server. The server removes the client from the session and destroys the session when there are no more clients in the session.
Hope that gets you thinking.
i have found some answers to this that i feel i should share:
Windows 2003 server has a limit on the number of ports that may be used. but this is configurable via a registry tweak to change the MaxUSerPort setting from 5000 to say, 64k( max).
Exploring further, i realize that the 64k port restriction is actually per IP address, hence a single server can easily attain much more ports, and hence TCP connections by either installing multiple network cards, or binding more than one IP address to a network card. that way, you can scale your system to handle n x 64k ports.
Had for days a problem with the available sockets on my Window 7 machine. After reading some articles about socket leaks in Win 7, I applied a Windows patch - nothing changed.
Below there is an article describing windows connection problems in great detail:
http://technet.microsoft.com/en-us/magazine/2007.12.network.aspx
For me it worked the following:
Open Regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters: Create TcpNumConnections, REG_DWORD, decimal value 500 (this can be set according to your needs); EnableConnectionRateLimiting, REG_DWORD, value 0;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip: Create MaxUserPort, REG_DWORD, decimal value 65534
Restart Windows

Programmatic Method For Opening Ports

I've searched this subject in stackoverflow and found out that a telnet library would help, and I found a telnet lib here: C# Telnet Library
but I don't know how I can use a telnet library to open a port in my router. I'm using an AT&T 2wire router. Any hints on how I can do this?
You can't. The 2wire router is an island unto itself, if it decides to block a port nothing external can (or should) be able to change that. You are on the wrong track, and would need to restate your goals in order to get a useful answer.
UPnP and other "Hole Punching" techniques do exist: but you'll be in a world of hurt if you try to reply on them for any widespread deployment.
Perhaps you meant to open a connection to a remote server and then establish two way communication. That is easy... and how other games and tools get the job done.
Technically speaking you should not be able to. You shouldn't have outside programatic access to a router to open a port if it's blocked.
If what you mean is opening a port for communication (that is not blocked) then you can simply create Sockets with the address and port (ex. localhost 7777) to establish inter process communication or simply communication with another server.
As I mentioned in a comment below there are ports that are available for use (in C# this can be easily tested, a quick google search will find you many snippets of code for testing if a port is open). A simple approach is to simply start at port 1024 (I believe this is the correct lower bound for ports that should be used by applications, someone correct me if I'm wrong) and just start counting up until you find a port that is available, if you find you've reached some upper limit you can simply report that a connection cannot be made. I hope this clears up a little more and if I have time I will try to find some code I have for this and edit it in but honestly a quick search can net you similar code for checking ports in C#.

Localhost packet analyzer for Mac

Packet sniffers generally do not capture localhost traffic. I need to inspect some post data in a localhost environment (being generated from a Ruby on Rails development). Do you know of any programs that expose localhost packets?
I use fiddler on my Windows box for http sniffing. Since its only looking at http traffic you don't get nearly the amount of noise you get with something like WireShark.
The trick to getting it to work with data sent and received locally is to use a different endpoint for your urls. Using http://127.0.0.1./YourServiceName instead of http://localhost/YourServiceName has always worked for me. Its important to include the trailing 'dot' in the IP address. Don't ask me why though.
If you use Firefox, you could use the HTTP Logging feature:
https://developer.mozilla.org/en/HTTP_Logging
If you just change your address from localhost to an assigned IP address (like 192.168.12.34 or whatever you may have), your packet sniffer should be able to see the packets.
These packets probably do not exist. There is no reason to packetize data when it is not leaving the host. The data should just go from socket to socket.
You might use something like Instruments or Dtrace to monitor the send system call.
I'm a satisfied user of HTTPScoop: http://www.tuffcode.com/
It's similar to the HTTP traffic analyzer addons you'll see for firefox etc. but works systemwide which is convenient and can be switched to observe any of your available network interfaces.
It is not free, nor does it observe HTTPS traffic, but other than that it's a worthwhile addition to your toolbox.

Resources