sockets

CSocket is not blocking on send.

This function is called to serve each client in a new thread. in the consume function, these archives are read and written to but the function returns before the client finishes reading all the response so the socket goes out of scope and closed, creating an exception in client. I'm assuming that any write on the CArchive should block un...

TCP Connection Seems to Receive Incomplete Data

I've setup a simple TCP file transfer. Everything appears to work OK, except for the received file size is sporadically a smaller size than the file that was sent. There doesn't appear to be any pattern to the size of the received file. (in the code below, note that the typical client/server rolls are reversed) My client code is like...

Signed Unsigned Applets / Java Web Start, Socket Connections?

Hello There, I have been developing a test framework for a particular client/server product (COTS) that exposes XML requests & responses via a raw ip socket. I have been able to develop my test framework in a PHP application with good results, but my desire is to make the test framework easily portable. Sure a VMWare image is portab...

How to find the IP Address of Client connected to Server?

My client pc is connected to as server pc via sockets over Ethernet, How do I find the IP of this client from the server side code. The server is dishing out one socket per client in a new Thread. When I do a csocket.getLocalAddress().toString() on the client socket I still get the Server IP address. (csocket is the socket that the Serve...

C++ STL based socket library

I need a C++ STL (iostream, string, etc.) based tcp socket client / server. Does anybody know such library? ...

Are sockets so slow in PHP?

I'm using this code for sockets. Console says that the page is processed for a very small amount of time, but Chrome says that page is loading for ~1 second! $this->serv_sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($this->serv_sock, $this->serv, $this->port) or die("Could not bind to address\n"); socket_listen($th...

C# Getting packet data

Hi, I've been trying to write a script that will sniff HTTP headers. So far I've got the socket bound to port 80 and packets seem to be received, but I can't get them into string form. All that outputs is "E" continuously. I changed the bytes into hex earlier and there seems to be some data coming in, but the current code is unable to c...

Any design pattern that will be helpful in implementing asynchronous communication using sockets?

Here is a brief description of what I want to accomplish. I am developing a peer to peer application using sockets. I want all my communication to be asynchronous. When ever a peer will ask another peer for something, it will send him the request tagged with a unique id. He will also store this information that what should he do with he...

accept/epoll problem

I have this code that uses epoll and it has a problem. When I run it, it gives output: Server-socket() is OK... Server-bind() is OK... 3 4 accept: Invalid argument I'm running it on ubuntu linux, system updated, both as limited user and root what is wrong with the input to accept? What should I change? struct epoll_event ev, events[...

Create binary data using Ruby ??

i was palying with the ruby sockets, so i ended up trying to put an IP packet togather, then i took an ip packet and try to make a new one just like it. now my problem is: if the packet is: 45 00 00 54 00 00 40 00 40 01 06 e0 7f 00 00 01 7f 00 00 01, and this is obviously hexadecimal, so i converted it into a decimal, then into a binary...

Java File Transfer getting stuck halfway

I am trying to send a file (an image sent as a byte array) with the client and then the server should receive said byte array to make further use of it. However when I click on the "send" to send the image the file transfer starts (as I get a sentImage.jpg in my Desktop) but it gets stuck for some reason I can't figure out and the image ...

sending formatted messages across TCP connection

I have an existing C program which prints a number of messages to standard error using: fprintf(stderr, ... I would like to modify this program so that these messages are also sent out over a TCP connection across the Internet. (Which I have already created as a SOCK_STREAM socket.) What's the best way format the messages like they wo...

Using the netinet functions on iPhone causes the UI to not refresh

I'm including the netinet headers and doing some raw socket programming on the iPhone, and have found when making these calls, the UI won't refresh until I'm finished- any response I get and write to the UI, isn't written until the IBAction that made the call is complete. Using performSelector with a delay, I've been able to work around ...

C# DatacontractSerializer over Sockets multiple root elements

I am writing a Sivlerlight Chat application using Sockets and the DataContractSerializer. I have a class hierarchy of serializable objects with the definitions shared between the Silverlight Client and the C# Server. When a buddy logs on they send a message to the server and if they are verified they are sent an acknowledgment follow...

How to copy a char[] in c into my struct

I am trying to send my struct over a UDP socket. struct Packet { int seqnum; char data[BUFFERSIZE]; }; So on the sender I have bytes = sizeof(packet); char sending[bytes]; bzero(sending, bytes); memcpy((void *) sending, (void *) &packet, sizeof(bytes)); bytes = sendto(sockfd, sending, sizeof(sending), 0, (struct sockaddr *...

How do I compare two timestamps in C?

I'm writing a socket program that maintains FIFO queues for two input sockets. When deciding which queue to service, the program pulls the most recent time-stamp from each queue. I need a reliable method for comparing two timeval structs. I tried using timercmp(), but my version of gcc doesn't support it, and documentation states that ...

select() on socket (trouble)

Recently I have done this part of code: http://dumpz.org/14945/ It does work, but select() works bad. When it has got last reply from server, it begins repeating last reply string with some strange characters in the beginning of reply string. So look at this: :[email protected] PRIVMSG testuser1 :VERSION �C���C��[email protected] PR...

Java Socket TCP Maximum Segment Size

Hi Is there a possibility to read out the TCP "MSS" option header of a Connections SYN packet or is this buried too deep in layers of layers of layers ? Thanks ...

Returning data from asynchronous socket requests correctly?

Hi all, This is my first foray into asynchronous socket development, so I'm open to any and all suggestions - thought I do have a specific q. My objective is to make a series of httpRequests using raw async sockets, I need to grab the http response headers that the server replies with. I adapted the code from this MSDN article: http://...

Multiple TCP/IP servers and sharing the same "well known port" ... somehow?

I apologize for the weird question wording... here's the design problem: I am developing a server (on Linux using C++, FWIW) that provides a service to many instances of a client application running on consumer PCs. I want the following: 1) All clients first identify themselves to a "gatekeeper" server application. Consider this a lo...