networking

Is length of ethernet header necessarily 14?

Code snippet from here: void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) { .... /* retireve the position of the ip header */ ih = (ip_header *) (pkt_data + 14); //length of ethernet header .... But this image doesn't say it's necessarily 14: How should I do it prop...

What's pcap_pkthdr there for?

Code snippet from here: void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) { .... /* retireve the position of the ip header */ ih = (ip_header *) (pkt_data + 14); //length of ethernet header .... What's const struct pcap_pkthdr *header for(definition), when do we...

How do I set the Internet Options? Specifically the LAN Settings tick boxes.

I'd like to set the tick box options within the LAN settings of the Internet Options: I'd prefer the code in a script or C#, but C/C++ would be fine as well. Please answer with the code/script to at least untick the "Use automatic configuration script" option. THANKS! ...

DataOutputStream, does it lose some bits

hello, I'm writing a client server application, but I don't receive the same bytes at the client side when they are sent from the server side. At the server side I used .write(bytes[]) method. At the client side, I used .readFully(byte[]) method. Do you have any idea ? The sent code: System.out.println("Server got connection fro...

flow-tools protocol numbers

When using flow-print to print the netflows into ASCII, I get 3 different values for protocols, ie protocol 1,6,17 ? What does that mean ? Thanks ...

How do I modify a HTTP response packet with winpcap?

There are two problems here: What if content is encoded:gzip... Do I also need to change the header part to make the HTTP packet valid(checksums if any?) UPDATE Can someone with actual experience elaborate the steps involved? I'm using winpcap and bpf tcp and src port 80 to filter the traffic,so my job lies in this callback functio...

twisted reactor stops too early

I'm doing a batch script to connect to a tcp server and then exiting. My problem is that I can't stop the reactor, for example: cmd = raw_input("Command: ") # custom factory, the protocol just send a line reactor.connectTCP(HOST,PORT, CommandClientFactory(cmd) d = defer.Deferred() d.addCallback(lambda x: reactor.stop()) reactor.c...

Ruby TCPSocket read_all

Is there a method that can act like read_all, as in instead of using TCPSocket.read(no_of_bytes), one can simply TCPSocket.read_all. I am sending objects first by YAML::dump'ing them then sending them but I don't know a way to get their size in bytes. Thanks in advance, ell. Oh and I am very, very new to any form of network programming s...

Java Connections netstat -ano

I am new to java and I have been testing my application all day long. I just did netstat -ano and it gave me a huge listing of active connections (listening, established) does this mean when i close my appliation these connections are not being shutdown (close())? here is a screenshot: any advise on how to go about closing th...

What's the shortest way to generate a random IP address in Ruby?

Just like the title says, wanted for testing purposes. Thanks! ...

Amazon EC2 - network issues

Hi, We are launching hadoop cluster on amazon ec2 and recently we are having network issues like master unable to connect to slave. We thought the reason is due to amazon throttling the network connections over a limit. So, we tried to establish a connection after a random delay from each slave node. But, that didn't help. Are there an...

Linux network stack : adding protocols with an LKM and dev_add_pack

Hello, I have recently been trying to familiarize myself with the Linux Networking stack and device drivers (have both similarly named O'Reilly books) with the eventual goal of offloading UDP. I have already implemented UDP on the NIC but now the hard part... Rather than ask for assistance on this larger goal I was hoping someone coul...

Why packets injected with libpcap are duplicated?

I'm using sharppcap in order to send packets as part of a monitoring system. Usually it works well but I've encountered the strangest bug on a hosted vista machine and I would like your help. On that virtual vista machine, injected packets are duplicated. That is, if I send a ping request using libpcap, it somehow gets duplicated and I ...

Capturing network traffic on Linux

Question: I have one Windows laptop, one Linux laptop and a wireless router. Now I want to "investigate" the hotmail/windows live protocol. What I want to do is route network traffic from the windows laptop via ethernet to the linux laptop, capture it on the Linux computer, forward it wirelessly to the router, receive the hotmail respon...

What C/C++ library do I use to change an HTTP packet in windows?

It seems winpcap can't be used to do this kind of job(ref), then which library to use alternatively? ...

Determine if a server is listening on a given port

I need to poll a server, which is running some propriatary software, to determine if this service is running. Using wireshark, I've been able to narrow down the TCP port its using, but it appears that the traffic is encrypted. In my case, its a safe bet that if the server is accepting connections (i.e. telnet serverName 1234) the servic...

Implementing a personal firewall for Windows, how can I determine what application does a packet belong to?

I am going to build a sort of personal firewall for Windows. I've found some articles on this subject on the Net, including some questions here on StackOverflow. But all they mean to control protocols, addresses and ports. It is as well important for me to control on per-application basis. Any suggestions on where to look? ...

How do I tell if a bonjour service is wi fi or bluetooth?

I am building an app that sends information between two iPhones. The app is working great but the one problem I am having is that I have no way of telling whether bonjour is choosing wi-fi or bluetooth to make the connection. I would like to allow the user to be able to choose which they prefer. Also, is there way to programmatically ...

Best way to do interprocess communication on Mac OS X

I'm looking at building a Cocoa application on the Mac with a back-end daemon process (really just a mostly-headless Cocoa app, probably), along with 0 or more "client" applications running locally (although if possible I'd like to support remote clients as well; the remote clients would only ever be other Macs or iPhone OS devices). Th...

Slowdowns when reading from an urlconnection's inputstream (even with byte[] and buffers)

Ok so after spending two days trying to figure out the problem, and reading about dizillion articles, i finally decided to man up and ask to for some advice(my first time here). Now to the issue at hand - I am writing a program which will parse api data from a game, namely battle logs. There will be A LOT of entries in the database(20+ ...