network-programming

Getting the 'external' IP address in Java

Hi I'm not too sure how to go about getting the external IP address of the machine as a computer outside of a network would see it. My following IPAddress class only gets the local IP address of the machine. Any help would be appreciated. Thanks. public class IPAddress { private InetAddress thisIp; private String thisIpAddress; pr...

recv with MSG_NONBLOCK and MSG_WAITALL

Hello I want to use recv syscall with nonblocking flags MSG_NONBLOCK. But with this flag syscall can return before full request is satisfied. So, can I add MSG_WAITALL flag? Will it be nonblocking? or how should I rewrite blocking recv into the loop with nonblocking recv ...

How to migrate existing udp application to raw sockets

Hello Is there a tutorial for migration from plain udp sockets (linux, C99/C++, recv syscall is used) to the raw sockets? According to http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch03s04.html raw socket is much faster than udp. Application is client-server. client is proprietary and must use exactly same procotol as it was with u...

Link list usage in system programming

Hi, in spite of having so many efficient data structures, why is only linked list used so heavily in systems programming? Is it because it allows least usage of heap/less buggy code? Regards, Pwn ...

Network communication for a turn based board game

Hi all, my first question here, so please don't be to harsh if something went wrong :) I'm currently a CS student (from Germany, if this info is of any use ;) ) and we got a, free selectable, programming assignment, which we have to write in a C++/CLI Windows Forms Application. My team, two others and me, decided to go for a network-co...

Reading a network byte that I know is there but does not get through to my app

A really strange one. We have a .NET application that connects to a server sends some information and then reads some information. The data I read has a fixed length header. The first part of the header is 1 byte. The problem is when doing the 1 byte read the network call blocks as if there is no data to be read. Now I know the data is o...

Why does Java's socket.connect() consume 100% cpu resources?

I created a threadpool and gave it 50 tasks to connect to a server. So once it was done connecting, sending some data over, then disconnecting. It also has a read timeout set at 5 seconds (5000 long of course). I even set the thread pool to a max size of 1. I then fire this up, on linux, and ran htop (a better version of top) to check th...

Multiple Socket Connections

I need to write a server which accepts connections from multiple client machines, maintains track of connected clients and sends individual clients data as necessary. Sometimes, all clients may be contacted at once with the same message, other times, it may be one individual client or a group of clients. Since I need confirmation that t...

Is transmitted bytes event exist in Linux kernel?

I need to write a rate limiter, that will perform some stuff each time X bytes were transmitted. The straightforward is to check the length of each transmitted packet, but I think it will be to slow for me. Is there a way to use some kind of network event, that will be triggered by transmitted packets/bytes? ...

Properly handling NSURLConnection errors

Hi, I have a simple form interface set up that send username and password information to a server: (working) NSString *postData = [NSString stringWithFormat:@"user=%@&pass=%@",[self urlEncodeValue:sysUsername],[self urlEncodeValue:password]]; NSLog(@"Post data -> %@", postData); /// NSData* postVariables = [postData dataUsingEncodin...

Waiting for data via select not working

I'm currently working on a project which involves multiple clients connected to a server and waiting for data. I'm using select and monitoring the connection for incoming data. However, the client just continues to print nothing, acting as if select has discovered incoming data. Perhaps I'm attacking this wrong? For the first piece of d...

Does the port change when a TCP connection is accepted by a server?

When a client connects to a server using TCP, a new socket is created for the TCP stream. Does the connection remain on the same port the connection was made or does it get changed to some other port? ...

Does the .Net Framework Contain any Libraries for Monitoring Network Activity?

I'd like to experiment with writing my own little monitoring/firewall app. ...

Apache HttpClient CoreConnectionPNames.CONNECTION_TIMEOUT does nothing ?

Hi, I get strange behavior from HttpClient with parameter CoreConnectionPNames.CONNECTION_TIMEOUT set to 1. I would expect that HttpGet request would fail, throwing connection timeout exception and yet they are successful. This seems irrational as it actually means that TCP handshake finished in less then 1 millisecond. The httpclient ...

Java Servlet says file does not exist

Hello World! I have developed a java servlet that monitors a folder on a network drive for new files then does some actions on them depending on what kind of file it is. It worked in Eclipse when Eclipse and Tomcat were running with each other, but now that I have deployed it onto a server(different machine), the servlet keeps logging t...

Configuring Maximum Connections for WSE 3 Client

I'm working with an old WinForms app that uses WSE 3 to call a Java web service on a remote server. The app performs a load test by running a number of requests on a configurable number of threads. When running with one thread, 50 requests complete in 50 seconds and the time spent on each request is 1 second, plus or minus a small amou...

Books for transport layer protocol implementation in Computer Networks

Hello. I am trying to implement a transport layer protocol for my project. I am going to use Linux as my operating system. Could you please suggest me some books or links that explain the implementation of transport layer (like TCP)? Thank you.. Thanks, Bala ...

Per-Process Network Monitor in Obj-C?

I want to write a program that monitors packets in and packets out, or in other words, network statistics. Is there any useful class in cocoa? I know there are some existed tools, but it will be a sub-routine of my program. So I must implement on my own. Thanks a lot! P.S. I only want to calculate one program / process 's statistics r...

Buffer management for socket application best practice

Having a Windows IOCP app............ I understand that for async i/o operation (on network) the buffer must remain valid for the duration of the send/read operation. So for each connection I have one buffer for the reading. For sending I use buffers to which I copy the data to be sent. When the sending operation completes I release th...

Can I make ruby send network traffic over a specific iface?

I am writing a script that grabs the external IP address along with some other information about each iface. I can't figure out how to make ruby send traffic over a specific iface(eth0 and wlan0 for example). I am currently using the open-uri library to open http://whatismyip.org and read it into a variable. def get_external_ip begin ...