network-programming

Default Gateway in C on Linux

How do you find the default gateway of a routing table using C on Linux? I don't want to issue a call to the shell or read a file. There are ioctls for adding and deleteing routes (SIOCADDRT, SIOCDELRT) and I've found on reference to getting routes (SIOCGRTCONF) but it seems that the version of the kernel I'm using doesn't support SIOC...

Protocol simplicity versus "properness"

I have another argument with a friend of mine. Consider having a need to design a simplistic JSON-based protocol, which is basically used to send sort of events (messages) between parties. Say, something like { event_id: 1, chat_message: "Hello" } { event_id: 2, group_id: 3, presence: "online" } ... I propose to keep this protoc...

Networking Framework for C++ (UDP or TCP)?

I'm writing a threaded cross-platform application (Linux/Windows) using SDL and OpenGL, and to do networking I was considering SDL Net2 because it sits on top of SDL_Net. However, I've never done networking in C/C++ before, so I'm unfamiliar with any available cross-platform technologies. Is there anyone with experience with SDL_Net or ...

CFReadStreamHasBytesAvailable polling - best practices

I'm currently polling my CFReadStream for new data with CFReadStreamHasBytesAvailable. (First, some background: I'm doing my own threading and I don't want/need to mess with runloop stuff, so the client callback stuff doesn't really apply here). My question is: what are accepted practices for polling? Apple's documentation on the subj...

Testing of socket communication program

Am starting with socket programming with a simple UDPClient program to send some data. The large code snippet is below: using System; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; class ShowIP { public static void Main(string[] args) { string name = Dns.GetHostName(); //n...

How can I reverse engineer an application's protocol?

I'm using an application (an instant messenger) which is not very popular. I'm trying to find the protocol that it uses. I know it's using TCP/IP but I want to find out all the commands that it is sending to the server and receiving from the server. I tried a couple of sniffers, but they can not recognize this application by name and mo...

Problem with IP_HDRINCL?

I already asked this question on raw IP packet implementation. But I didn't get any solutions. My code: if((s = WSASocket(AF_INET, SOCK_RAW, IPPROTO_TCP, 0, 0, 0))==SOCKET_ERROR) // Socket { printf("Creation of raw socket failed."); return 0; } if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval))...

Most seen newbie mistakes in multiplayer/online game programming?

What kind of newbie mistakes you've seen and what are the cures? One which occurs again and again is client is not checked any way against server. For example: User decompiles flash game source or listens to network traffic and sees where high score data is going and sends bogus high scores there not even playing the game. User uses ...

What's the difference between computer network and telecommunication network?

When we talk about network programming, does it means the "network" here is just the computer network? And what is the difference between the computer network and the network that not belongs to computer network? ...

Android (Java) network programming resources

Hi, I would like to develop an application for Android which would transfer data through TCP connection. Does anyone know for any good example or book where client-server connection example could be found? I'm quite new with Java and Android so I would be very thankful for any suggestion. ...

How to get my non-loopback network ip address in C?

For a communication between two hosts, I need to send the IP address of my host to the other site. The problem is that if I request my IP address, it might be that I get back my local loopback IP addres (127.x.x.x) , not the network (ethernet) IP address. I use the following code: char myhostname[32]; gethostname(myhostname, 32); hp ...

Visual C++ API for Network Monitoring

I have to make a network monitoring application, under Visual C++ (Windows) What libraries or APIs do you recommend me to use? ...

what is it called when a program talks with other programs or other computers

Hi As a true beginner, one often finds that the barrier to further knowledge is not knowing what to google. I've made programs like pong and a sudoku solver, simple things. These days I would like to work on something more like tabslock or make a multiplayer pong, or at least start thinking about what that would involve. So what exac...

Writing a socket-based server in Python, recommended strategies?

I was recently reading this document which lists a number of strategies that could be employed to implement a socket server. Namely, they are: Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification Serve many clients with each thread, and use nonblocking I/O and readiness change notifica...

C/C++ Windows traffic blocker

I want to develop a bandwidth allocator to a network which will be behind my machine. Now, I've read about NDIS but I am not sure whether the network traffic that is neither originating from my machine nor is destined for my machine will enter my TCP/IP stack, so that I can block/unblock packets via NDIS on a windows machine. ...

Open Source & Cross Platform Multiplayer/Networking Libraries?

While raknet seems fairly interesting and really appealing from a feature-point of view, its licensing terms seem to be possibly troublesome for GPL'ed projects that may be leveraged commercially, something which is explicitly forbidden by the terms of the creative commons license. While there's also opentnl, it doesn't seem to be as a...

Find Packet Loss and Trace Route in .NET

Hello All: I am trying to code to capture the packet loss on computers, but the only way I've been able to do so was to run the NetStat.exe and the TraceRt.exe processes and capture them to a listbox (using the code below): Private Sub myProcess() Dim p As System.Diagnostics.Process Dim theFile, sTemp, sLineOut, mySent, myRetr...

What does 'end of stream' mean when working with sockets

When working with Sockets in Java, how can you tell whether the client has finished sending all (binary) data, before you could start processing them. Consider for example: istream = new BufferedInputStream (socket.getInputStream()); ostream = new BufferedOutputStream(socket.getOutputStream()); byte[] buffer = new byte[BUFFER_SIZE]; i...

Is SCTP good for peer-to-peer apps?

I am considering using SCTP instead of TCP for a p2p app written in C. Should I do it? Also how does the speed of SCTP compare to the speed of TCP? EDIT: I found that SCTP can be tunneled over UDP with the only problem being tunneled SCTP is not interoperable with untunneled SCTP. ...

An example project for network-programming written in C/C++

Are there good open-source projects on P2P file-sharing systems or distributed file systems written in C/C++ ? I need a project to start with network-programming. Can anyone give me any suggestions? ...