network-programming

Write program like netstat

I would like to write an application like a netstat - to show all the active connections and the open ports respectively. The problem is that I don't know how to do it - I've done some network programming but in general it was some simple server-client packet and simple TCP and UDP packets sending/receiving. I looked at the netstat cod...

c++ accessed url log.

im now currently developing a standalone c++ program that would list all the access URL in a browser and its corresponding response time.... at this point of time, i can already sniff all out and in going packets. i am using winpcap for this... retrieved packets were filtered to by only those 'tcp port 80(http) or 443(https)'... and kn...

How can i get IP Address of my 3G modem?

My GPRS modem has got a sim card. it can connect Web. Web service give it a ip number. i need it. like that: http://www.your-ip-address.com/ How can i do that C#? ...

how can i learn my client ip with .NET?

i need my client ip from whatismyip.com. But Regex pattern is not correct i think? Can you help me this patttern? ...

Matching an ip address to a table of subnet masks... What is the best approach in Java?

Here's the scenario... I have a table of subnets. (see below) I have an ip address. I would like to find out what subnet the ip address belongs to based on a lookup in the table. This association will then be used to determine what location the user is at. It's a private network space so the standard internet to location lookups wou...

ARP Table entries

I am using following code to retrieve MAC address for an IP address. public string GetMACAddressFromARP(string ipAddress) { IPAddress ipAdd; try { ipAdd = IPAddress.Parse(ipAddress); } catch (Exception ex) { return null; ...

Receiving Network Messages using sockets on iPhone

Hi all, I am currently trying to connect an iPhone to a predetermined custom server. I have managed to make this connection using a simple easy to follow example I found in some forum. This code is as follows: - (void)sendcmd:(NSString*)cmd { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *hostname=...

How to solve '...is a 'type', which is not valid in the given context'? (C#)

i want to call this class from my Winform.But if i write this codes. Compiler send me error. What is solution. Please help me Error : 'CERas.CERAS' is a 'type', which is not valid in the given context using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinApp_WMI2 { public partial clas...

Web Sockets: Browser won't receive the message, complains about it not starting with 0x00 (byte)

Here is my code: import java.net.*; import java.io.*; import java.util.*; import org.jibble.pircbot.*; public class WebSocket { public static int port = 12345; public static ArrayList<WebSocketClient> clients = new ArrayList<WebSocketClient>(); public static ArrayList<Boolean> handshakes = new ArrayList<Boolean>(); pub...

How to receive multiple UDP packets in C?

I made a function to send an UDP packet to a server and to get the returned packets. When i make a single recvfrom call it works, but i need to get all potential packets from the server within the defined timeout. Here's my code: http://pastebin.be/23548 Can someone help me? Thanks. ...

Is there a cross-platform network library for the iPhone?

Is there a cross-platform network library for the iPhone? Is ACE available for the iPhone? I would like the networking library to be available for iPhoneOS, OS X, Windows (XP, Vista, and Win7 would be nice but at least XP), Android, and Blackberry. ...

Client use high port number

Hi, Why does the client end of a connection use high port number(ephemeral ports) whereas the applications listen on typically small port numbers ? Thx in advans, Karthik Balaguru ...

Unix TCP servers and UDP Servers

Why is the design of TCP servers mostly such that whenever it accepts a connection, a new process is invoked to handle it . But, why in the case of UDP servers, mostly there is only a single process that handles all client requests ? ...

measuring response time through packets?

good day! im developing an app in c++ and winpcap that will list all the URL accessed in the browser with its corresponding response time.. currently, i can now track or monitor all accessed url through capturing and analyzing packets.. is there any way of measuring the response time of a web page to load, from the request made to the se...

File Descriptor Sharing between Parent and Pre-forked Children

In Unix Network Programming there is an example of a Pre-forked server which uses message passing on a Unix Domain Pipe to instruct child processes to handle an incoming connection: for ( ; ; ) { rset = masterset; if (navail <= 0) FD_CLR(listenfd, &rset); /* turn off if no available children */ nsel = Select(maxfd...

recvfrom max buffer TCP/IP

Hello, I am writing a small C program to understand sockets. What is the maximum length of data returned from recvfrom? recvfrom(raw, packet_buffer, buf_size, ... ); what is the maximum buf_size in linux. Is there a constant related to this size_t? Thanks ...

More data in packet payload

I have the following code int ParseData(unsigned char *packet, int len) { struct ethhdr *ethernet_header; struct iphdr *ip_header; struct tcphdr *tcp_header; unsigned char *data; int data_len; /* Check if any data is there */ if(len > (sizeof(struct ethhdr) + sizeof(struct iphdr) + sizeo...

Error parsing IP header

Hello, I have a small function that tries to print the fragment offset of an IP header. ParseIpHeader(unsigned char *packet, int len) { struct ethhdr *ethernet_header; struct iphdr *ip_header; /* First Check if the packet contains an IP header using the Ethernet header */ ethern...

Identify equal paths

Is there's any simple way for identifying whether 2 (or more) paths point to the same location (assuming I only have read permissions)? e.g. \My-Machine-Name\temp \212.200.10.5\temp c:\temp ...

Best way to resolve a DNS TXT record on Linux/Unix/Posix/BSD type systems?

I want to write some portable (as possible) C code to look up DNS TXT records. I would also prefer not to have dependencies on libraries that don't ship with the machine. What is the best way to do this on Unix-like machines using standard libraries? I found some sample code that works using libresolv, but it's not reentrant (not threa...