The closest example I can think of is iTunes. I'm thinking about a system where a server stores loads of files, and each user only has access to those they have paid for. Using a desktop app, they can download these to their local PC where they are stored as regular files.
How might one approach this? I can see a couple of possible opti...
Firstly, I'm relatively new to network programming. I want to intercept and delay HTTP traffic before it gets to the server application. I've delved into libnetfilter_queue which gives me all the information I need to delay suitably, but at too low a level. I can delay traffic there, but unless I accept the IP datagrams almost immediatel...
I want to try and get the ip address of a client after calling accept. This is what I have so far, but I just end up getting some long number that is clearly not an ip address. What could be wrong? Thanks to anyone who replies.
int tcp_sock = socket(AF_INET, SOCK_STREAM, 0);
sockaddr_in client;
client.sin_family = AF_INET;
socklen_t...
Okay - I'm beaten.
I have a (PHP-CLI) server written using PHP's socket_* functions. I can connect just fine to it using Putty and it works as expected.
However my PHP-CLI client does not work properly. It seems like the client is trying to grab the socket from the server (yes the server/client are on the same system).
They do se...
I'm trying to set up a blocking socket to timeout after 16 ms of trying to recvfrom() on a port. Platform is Windows. I've looked at tons of examples online and it seems really simple I just can't seem to get it to work. Any help would be appreciated!
#include <winsock2.h>
#include <string>
#pragma comment(lib, "ws2_32.lib")
#defin...
I have 2 windows PC's connected over an ad-hoc wlan network.
Using this existing connection can I communicate between these pc's via sockets?
Can I open a server socket on one pc and make the other pc a client and connect to the other pc and then send and receive data over this connection?
Do I need a specific api for this or can I just ...
this is the code that i get so far...
import java.net.*;
public class PortScanner {
public static void main(String args[]) {
int startPortRange = 0;
int stopPortRange = 0;
startPortRange = Integer.parseInt(args[0]);
stopPortRange = Integer.parseInt(args[1]);
for (int i = startPortRange; i <= stopPortRang...
Hello,
I'm building a very high performance Linux server (based on epoll, non-blocking sockets, and async disk IO [based on io_submit/io_getevents/eventfd]). Some of my benchmarks show that the way I handle sockets isn't efficient enough for my requirements. In particular, I'm concerned with getting data from the userspace buffer to the...
Hi All,
I'm writing an HTTP client using the .Net TcpClient / Sockets.
So far, the client handles both Content-Length and chunked responses by iterating through the NetworkStream response (after writing a GET request to the TcpClient), parsing the headers and retrieving the relevant message body bytes / chunked bytes. To do this it us...
I'm building a socket application that need to shuffle a lot of small/medium sized files, something like 5-100kb sized files to a lot of different clients (sort of like a web server, but still not quite).
Should I just go with the standard poll/epoll (linux) or async sockets in winsock (win32), or are there any methods with even more pe...
I'm working on a homework problem for class. I want to start a UDP Server that listens for a file request. It opens the file and sends it back to the requesting client with UDP.
Heres the server code.
// Create UDP Socket
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
perror("Can't create socket");
exit(-1);
...
I'm trying to implement a binary protocol between a flash application and a Custom Java Server using TCP/IP sockets, the protocol's messages are of variable length, so my idea is to add a field indicating the number of bytes I have to read before parsing a complete message, something like this:
bytesToRead = socket.readInteger();
var bf...
I have a UDP Server that should sit and wait for a client to connect to it, and send it a string of a filename. Right now I just want it to echo back the filename to the client. Here is my code
Server
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/s...
Hello people,
I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setti...
Hi,
I have a service running on localhost:port. In a bash script I want to connect to this port, send a request, and read back the response - essentially automating a telnet session. What's the best way of doing this? Am looking at /dev/tcp, netcat or telnet/expect.
Thanks
...
I'm a dotnet propgrammer. recently i wrote aclient server application that use system.net.sockets for connecting and check client is on with a timer that clients send byte.minvalue for checking alive. when a client disconnected i shutdown the socket and close it. this work fine, but when number of clients increased connections can't esta...
I'm very new to socket programming:
Is it possible to explicitly set the the source port on a Java Socket?
I am working on a client/server application in which clients could potentially be listening for replies from the server on several ports. It would be nice if I could set this reply port on the client side when initializing the So...
Hi,
For the last couple of days I've been trying to figure out how sockets can be used in silverlight.
This thread has been helpful in finding resources but Im still trying to find out if it is possible to create 'local' sockets.
So could a silverlight application create a socket on the userside for the user to connect to using an iPh...
Hi,
I'm making a program in Java with Sockets. I can send commands to the client and from the client to the server. To read the commands I use a BufferedReader. To write them, a PrintWriter But now I want to transfer a file through that socket (Not simply create a second connection).First I write to the outputstream how many bytes the ...
/// <summary></summary>
private Byte[] _ReceiveBytes(Int32 size)
{
MemoryStream memory = null;
SocketAsyncEventArgs args = null;
EventHandler<SocketAsyncEventArgs> completed = null;
Exception exception = null;
Int32 last_update = Environment.TickCount;
Boolean finished = false;
Int32 count = 0;
Int32 rec...