network-programming

How to write a http1.0 proxy server in c in linux?

I must develop proxy server that work with only HTTP 1.0 in Linux and by c . I need some hint to start developing . ...

Non-blocking socket on Windows doesn't return after send() call

I'm hoping someone can explain a situation -- any situation -- in which a non-blocking Windows socket would not immediately return after using send() on it. On other platforms, my code works as intended, so it appears to be a Windows-specific issue. The way I can tell it isn't returning is quite simple: I cout a message immediately befo...

Audio streaming from iPhone to a server?

How can I stream the audio recorded from iPhone to a server continuously? Am I really have to use RTP? Any other suggestions? Thanks. ...

What are the effects of incorrectly setting the netmask?

What are the effects of incorrectly setting the netmask? I have a C++ application that sets the network mask of a device. If the netmask is set incorrectly, tftp doesn't seem to work properly. Why would this happen? What other problems occur when the netmask is not properly set for a device/PC? ...

How to make a server send a processed data back to the invoking iPhone?

I am sorry if the title is unclear. Allow me to elaborate further. Firstly, I have an application on an iPhone that will allow the user to upload a data to server. We simply use php to allow the user to upload the data. Secondly, the server will process this data and then return the processed data back to this iPhone. This part is the ...

read() function in socket programming in c

I use this code for reading from socket : int n ; char buffer[256]; n = read(newsockfd, buffer, 255); if (n < 0) { error("ERROR reading from socket"); } if the data that must be read bigger than 255 byte (for example 1000) which change must be occured ? I know change char buffer[1000], I need different solution ....

Assign different IP for different threads in a .net program

The computer that runs my program has 6 different IP addresses assigned to it. I need that each thread will use a different IP address for its communication. Specifically I'm using the WebRequest object for communicating. so is there away assign each thread a different IP address to use instead of the default one? Thanks, Eden ...

route a custom url to a web-application

Hi, I have a Vista Home PC with computer-name say *office_pc1* and with IP say 192.168.11.40. I have a web-application, in that pc, which can be successfully accessed via the IP itself. Now, my question is how can I access that web-application if I'm entering the url as: http://support.somedomain.com/, in my local intranet. Is that pos...

DHCP : Cant receive reply from server

I am working on Ubuntu 9.04. I am running this on VMware workstation. Here is my C code: int sockfd,cnt,addrlen; const int on = 1; struct sockaddr_in servaddr,cliaddr; char reply[512]; sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { perror("socket"); exit(1); } setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR, &on,sizeof(on...

Descriptor passing with unix domain sockets

When we want to pass a descriptor from child to process, UNP V1(Unix network programming V1) specifies a complex procedure of doing this, first to create msghdr struct and then something, etc. Why cant we pass a descriptor as normal data means as we do send , recv for other data through unix domain sockets? I am able to understand the p...

Could somebody help me in spotting an error regarding uploading an image from iPhone to server here?

I am strictly following the answers from http://stackoverflow.com/questions/125306/how-can-i-upload-a-photo-to-a-server-with-the-iphone. This part below is the part that get called when my button is pressed. NSLog(@"buttonPressed: %@", [ConnectServerTryViewController getPathForFile: @"myPic.png"]); [[EPUploader alloc] initWithURL:[NSUR...

what is the difference between read() and recv() , and between send() and write() ?

what is the difference between read() and recv() , and between send() and write() in socket programming ? performance and speed and other behavior. ...

Why DHCP client listens on port 68?

If suppose client does not listen on 68 port,when DHCP server receives the request, it can send it to the address from where it received request (with ephemeral port chosen by client at time of sending), then why does protocol specifies client to be listening on port 68? ...

Implementing DHCP client

On unix using C, my client is listening on port 68 with superuser mode. After sending DHCP discover message, when I try to receive, it blocks in recvfrom means there is no message received or is it like system has a process (DHCP client) listening on same port 68 which receives the message and thats my process are not able to receive th...

Accessing data link layer packets

I want to create a socket for accessing IPv4 packets from data link layer. From unix network programming V1, socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP)) 1)I am implementing a dhcp client, is this the correct way of doing that? (means without accessing data link layer, i cannot receive reply from dhcp server) or is there any other e...

Check connection open or closed ?(in c in Linux)

In socket programming in Linux I need to write data in socket but I don't know socket is open or close . how to I know that socket is open and close without read ? printf("befor read%d\n", n); bzero(buffer, MAX_SIZE_BUFFER); n = read(sockfd, buffer, MAX_SIZE_BUFFER - 1); printf("after read%d\n", n); if (n <= 0) { break; } printf("be...

Finding the type of data in IPv4 packet

Excluding options field in IPv4 header, after 20 bytes of header, data follows. That data may be TCP packet, or UDP etc. Now given a IPv4 packet (with header and data), How to find out which type of transport layer packet (TCP/UDP/etc.) is present in data? Actually I am parsing a IPv4 packet so I need to understand this. ...

Using recvfrom() with raw sockets : general doubt

I have created a raw socket which takes all IPv4 packets from data link layer (with data link layer header removed). And for reading the packets I use recvfrom. My doubt is: Suppose due to some scheduling done by OS, my process was asleep for 1 sec. When it woke up,it did recvfrom (with number of bytes to be received say 1000) on this r...

POSTing to the web in Clarion

I'm developing a RESTful API for a client. The problem is, he's using a rather obscure language called Clarion. It's proprietary and closed, and the docs are not freely available online. Whenever we discuss passing data from his code to mine, and back again, he starts talking about "ftp file uploads" and direct server-to-server SQL. Nee...

Selection between ACE & Boost for learning

Hi everyone, I am an intermediate c++ programmer and done some work using ACE, now I want to learn one of those Libraries thoroughly to progress in to my career. That why I need your kind help to make a decision, that what should I learn first. And also please consider my destinations are to be an expert network programmer and Protocol d...