networking

How do I read and write raw ip packets from java on a mac?

What would be the easiest way to be able to send and receive raw network packets. Do I have to write my own JNI wrapping of some c API, and in that case what API am I looking for? EDIT: I want to be able to do what wireshark does, i.e. record all incomming packets on an interface, and in addition be able to send back my own created pack...

How do I measure bytes in/out of an IP port used for .NET remoting?

I am using .NET remoting to retrieve periodic status updates from a Windows service into a 'controller' application which is used to display some live stats about what the service is doing. The resulting network traffic is huge - many times the size of the data for the updates - so clearly I have implemented the remoting code incorrectl...

Getting the Hostname or IP in Ruby on Rails

I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do this in Ruby on Rails? Edit: The answer below is correct but the clarification Cra...

Sockets and Processes in Java

In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I'm not particularly savvy with network programming at the moment, so the tutorials I've found on the net aren't particularly helpful. Would it make sense to have the listening socket as a serversocket and run it in a s...

Windows packet sniffer that can capture loopback traffic?

(This is a followup to my previous question about measuring .NET remoting traffic.) When I am testing our Windows service / service controller GUI combination, it is often most convenient to run both pieces on my development box. With this setup, the remoting traffic between the two is via loopback, not through the Ethernet card. Are t...

Why do I get this error "[DBNETLIB][ConnectionRead (recv()).]General network error" with ASP pages

Occasionally, on a ASP (classic) site users will get this error: [DBNETLIB][ConnectionRead (recv()).]General network error. Seems to be random and not connected to any particular page. The SQL server is seperate from the web server and my guess is that every once and a while the "link" goes down between the two. Router/switch issue ....

How do you create a virtual network interface on Windows?

On linux, it's possible to create a tun interface using a tun driver which provides a "network interface psuedo-device" that can be treated as a regular network interface. Is there a way to do this programmatically on windows? Is there a way to do this without writing my own driver? ...

Can UDP data be delivered corrupted?

Is it possible for UDP data to come to you corrupted? I know it is possible for it to be lost. ...

UDP vs TCP, how much faster is it?

For general protocol message exchange, with loss tolerant. How much more efficient is UDP over TCP? ...

Configure static routes on Windows

There is a "netsh" and a "route" command on Windows. From their help text it looks like both can be used to configure static routes. When should you use one and not the other? Is IPv6 a distinguishing factor here? ...

Embedding a remote Python shell in an application

You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain port and launch a remote IPython shell? Any tips for redirecting the input/output streams for IPython or how to hook it up to a telnet ...

How can you find out which process is listening on a port on Windows?

How can you find out which process is listening on a port on Windows? ...

Can't Re-bind a socket to an existing IP/Port Combination

Greetings, I'm trying to find a way to 'unbind' a socket from a particular IP/Port combination. My pseudocode looks like this: ClassA a = new ClassA(); //(class A instantiates socket and binds it to 127.0.0.1:4567) //do something //...much later, a has been garbage-collected away. ClassA aa = new ClassA(); //crash here. At this p...

Controlling which Network Card TCP/IP message are sent on

The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/IP messages. I now ha...

Checking network status and controlling PPP in a program

So I'm running PPP under linux with a cellular modem. The program I'm writing needs to know if the link is active before sending any data. What are my options to check if the link is available if it routes to a server I control (it doesn't go to the internet as I said earlier) Also, what is the best way to restart it - I'd like to ...

OpenWRT and 5 GHz

What's a good router that does dual band 2.4 GHz and 5 GHz and can run OpenWRT? ...

Regular expression that matches valid IPv6 addresses

I'm having trouble writing a regular expression that matches valid IPv6 addresses, including those in their compressed form (with "::" or leading zeros omitted from each byte pair). Can someone suggest a regular expression that would fulfill the requirement? I'm considering expanding each byte pair and matching the result with a simp...

Finding network alias in .net

Is there a way in .net 2.0 to discover the network alias for the machine that my code is running on? Specifically, if my workgroup sees my machine as //jekkedev01, how do I retrieve that name programmatically? ...

How Do I Access The Host From VMware Fusion?

I've just created a new Windows XP VM on my Mac using VMware Fusion. The VM is using NAT to share the host's Internet connection. How do I access a Rails application, which is accessible on the Mac itself using http://localhost:3000? ...

How can I find the current DNS server?

I'm using Delphi and need to get the current Windows DNS server IP address so I can do a lookup. What function should I call to find it? The only solution I have right now does an ipconfig/all to get it, which is horrible. ...