network-programming

Detection of connection and speed of Cellular Network vs. 802.11 and Ethernet? C# .Net

I am working on a program which will be used on mobile devices (Full Windows install) that may have 3G connectivity. If the particular device does have 3G connectivity, we would like to take advantage of it. However, the program should be able to prioritize communication based on what type of connection and speed are currently availabl...

General timing problem in network programming

Suppose that there're two types of packet in the chatting server. Those two packets are used for getting the status of another user. One(call this as REQ-STAT, RES-STAT) is request-and-response form and another one(NOT-STAT) is notification form packet. For instance, if I send [REQ-STAT simpson] to the server and I may get [RES-STAT sim...

Framework/approach to use for 'alerter' type applet?

A client has a lashed-together 'alerter' system based around batch files and 'NET SEND' commands. He edits the batch files (adding/removing users) as necessary. His requirements are getting a bit more complex now; he wants users to be able to drop in and out of the notifications, during the day. I got to thinking about some kind of tray...

Performance impact of using write() instead of send() when writing to a socket

Hello; I am working on writing a network application in C++ on the Linux platform using the typical sockets API, and I am looking at 2 alternative ways of writing a byte array to a TCP stream: either by calling write(), or by calling send(). I know that, since this is Linux, the socket handle is simply a file descriptor, and therefore ...

Python tell when an ftp transfer sits on completion

I have to download some files from an FTP server. Seems prosaic enough. However, the way this server behaves is if the file is very large, the connection will just hang when the download ostensibly completes. How can I handle this gracefully using ftplib in python? Sample python code: from ftplib import FTP ... ftp = FTP(host) ftp.l...

Fastest way to tell if SQL Server is available

I have a winform program that uses Merge Replication to keep a local SQL Express sync'd with a Central SQL Server on our network. Due to the nature of this app the sync process runs automatically on App open and close. The way I am doing it (below) seems quite time consuming. What would be a faster way? Thinking outside the box it...

"Sliding Window" - Is it possible to add reliability to a protocol and avoid flow control Implementation?

As a part of a personal project, I am making an application level protocol (encapsulated in UDP) which is reliable. For the implementation of reliability, I have to keep track of which packets i send, and which packets are received at the other receiver end. This is done with the help of a sliding window, and it also maintains the flow-...

Should I use #defines or enums for commands over network?

I have to transfer some values to be used as commands over the network, and I wish to make it as efficient and robust as possible, i.e. I need opinions on what to use for these commands, #defines or enums? The range of commands shall not be more than 20 commands(lets say 40 with every defined response to the command), so according to mo...

Refusing connection from a host

I'm writing a simple tcp server application using sockets. As far as I know I can obtain the client's ip address and port after calling accept(). Now lets assume I have a banlist and I want to ban some ip addresses from my server. Is there a better way than accepting the connection and then dropping it? Is there a way to get the clien...

Keeping objects in sync across a network?

In my application, I have two DLLs. One is written in C# and the other in C++. They communicate with each other across a network. Each has a list of object instances that are expected to be in sync with each other at all times. What network libraries are available for doing this? ...

UNIX nonblocking I/O: O_NONBLOCK vs. FIONBIO

In every example and discussion I run across in the context of BSD socket programming, it seems that the recommended way to set a file descriptor to nonblocking I/O mode is using the flag to fcntl(), e.g. int flags = fcntl(fd, F_GETFL, 0); fcntl(fd, F_SETFL, flags | O_NONBLOCK); I've been doing network programming in UNIX for over te...

Java Chat Server

I am writing a java based chat server and currently my design is based on following :- when a person in a chat room sends a message, the chatroom class at the server side, sends the same message to every participant in the room in a loop. Obviously , this is a poor design because networks calls are being made to individual participants i...

What network library on what IRQL?

I somewhat confused because I've read that "everything" should be possible at IRQL_PASSIVE, but I am not so sure whether this includes winsock2 or other userland libraries. My normal understanding would be to use the WSK interface. But it would be much more comfortable if I could use normal sockets. As I am running into builder errors a...

iPhone: Looking for an API to store survey results

In my iPhone app I am trying to gather feedback on my game via an optional survey. I would like to send this data to a central server, where I could gather all the statistics and process them to have a bar chart or other convenient presentation. The data being sent an integer representing the user's preference. ie) Given "How did you li...

How do I present ToS when I expected DSCP?

If my application is using DSCP values, and on the way some packets may be re-tagged by network equipment or other things. The problem is that the network equipment may just talk old-style ToS, meaning it thinks it can change just the Prio bits or the ToS-bits and all will be well. But all is not well! What do I do with this ToS-byte va...

IPV6 usage study

Hi all, I have a pertty overview on the TCP/IPv4 stack.I am planning to get into the next version of IP which is IPV6 which is for the future i believe.I really need some valuable inputs from anyone as to which site or link or may be i can do something practically by using some kind o0f simulators to learn something like atleast ...

Why no "what's my ip" well-known port/service?

I know there are some web sites that provide this service but given that pretty much everyone lives behind NAT these days, why isn't this standardized on a port and provided as a service to whomever wants to run it? It's at least as useful as an echo, daytime or "quote of the day" server and as easy to implement. Or does one exist that...

boost::asio doesn't work

With the following class the header: namespace msgSrv { class endPoint { public: asio::ip::udp::endpoint ep; endPoint(std::string ip, int port); }; class msgSrv { private: asio::ip::udp::socket *asioSocket; asio::io_service *asioIoService; int listenPort; boost::array<char, 1> rcvBuff; asio::ip::udp::en...

Can a Java applet retain a socket connection when going to a new web page?

I have an applet that I want to maintain a socket connection between multiple web pages. Currently, when a transition is made to a different page, the socket connection is closed. Is there anyway of maintaining that connection between web pages? Or, do you have to reconnect the socket after each web page transition? ...

Flash client XMLSocket not connecting to server.

I have a Flash client that I want to connect to a server. Both are using localhost and port 50000 so there shouldn't be any cross-domain problems. I also set Access Network Only in the publishing settings. When I call the XMLSocket connect, the server seems to get a new connection. But, the XMLSocket.onConnect callback is not called ...