sockets

How to communicate by (socket, Thread) to transfer file?

How to communicate by (socket, Thread) to transfer file? ...

problems sending picture from client to server

i am trying to send a picture from 'C:\picture.bmp' to 'c:\temp\picture.bmp' using server and client socket clients onconnect event handler is as follow: procedure TForm2.ClientSocket1Connect(Sender: TObject; Socket: TCustomWinSocket); var fs : tfilestream; begin fs := TFileStream.create('C:\picture.bmp', fmOpenRead);//pictu...

Manage opend connections on TCP server

Hi I have a TCP server application which is listening for incoming connections. after establishing the connection and some send/receive operations i want to close the connection by the server. for the first time server successfully close the connection but the client cant make another connection, or it halts. but if I close the connectio...

Socket programming in Perl

What is the best way to receive data from a socket in Perl, when the data length is unknown? Right now, I read one character at a time in a loop, until I reach the '\0' character. Is there a better way to do this? ...

Can a process use a socket created by another process?

I'd like to create an application that gets the ipv4 tcp table ( currently by using GetTcpTable() ), then gets a socket (searching for a particular IP address) and peeks data from that connection (it actually has to send data too). So we have two processes on the same machine, one that has a connection to a server, and another one that ...

How to send file from self to chatFriend?

I try to send file to chatFriend,I send a sendFileInformation include which file I select to send to Server which support we chat before I send file .Then Server send it to chatFriend ,when chatFriend get it,he will open a new ServerSocket and response to me,then send the file,chatFriend save the file.when transfer,he can give up. At ...

Ruby, SSLSockets, and Apple's Enhanced APN message format

I'm trying to implement support for Apple's enhanced Push Notification message format in my Rails app, and am having some frustrating problems. I clearly don't understand sockets as much as I thought I did. My main problem is that if I send all messages correctly, my code hangs, because socket.read will block until I receive a message. ...

What should the destination mac address be set to when sending packet outside of your local network?

If I use arp and arping on machines in my local network I get the mac addresses from them. In the same way I can construct and send a ARP request and collect the response to these machines. This is used since I build raw packets completely from scratchy (to allow spoofing of every possible field, including mac addresses if needed). But, ...

Closing all TCP sockets on interface Down

Hi there, I need to close all ongoing Linux TCP sockets as soon as the Ethernet interface drops (ie cable is disconnected, interface is down'ed and so on). Hacking into /proc seems not to do the trick. Not found any valuable ioctl's. Doint it by hand at application level is not what I want, I'm really looking for a brutal and global wa...

Why aren't all packets sent to the client?

I'm writing a simple proxy (more a packet logger) for an online game in C#. All the packets get received by the proxy but some aren't sent to the client (not sure about the server). For example: Client->Server: Login Packet - My proxy receives the packet, displays it and sends it to the server. Server->Client: Connected! Packet - My pr...

SendToAsync memory leak?

I have a simple .net 3.5sp1 windows application (in C#) that acts as a UDP server. It listens on a port, receives data from an endpoint, and then retransmits what it receives to another endpoint (i.e. a relay, for a live broadcast data stream). What I'm experiencing is after the connection is up for about 20 minutes, it starts to deteri...

Determining LocalSocket read size

Hey all, I'm using a UNIX socket to facilitate communication on and Android device between a system level daemon I've got running in C and an application I've got running in Java. I'm much more of a C coder than a Java coder, so I'm having some issues when trying to read in data from the socket on the Java side. Currently, my code is a...

XMLRPCPP asynchronously handling multiple calls?

I have a remote server which handles various different commands, one of which is an event fetching method. The event fetch returns right away if there is 1 or more events listed in the queue ready for processing. If the event queue is empty, this method does not return until a timeout of a few seconds. This way I don't run into any HTTP...

wxPython threaded UDP server

Hi, I am trying to put together a UDP server with a wxPython GUI. Here is a link to the code: UDP Server pastie.org I have linked it as its pretty lengthy. I have successfully got the UDP server running on the thread but I can not figure out how to close the socket when the stopping the thread. At the moment it will kick up a new t...

Error when POST and GET via Sockets .NET

I'm trying to post to an ASP.NET Site via Sockets by sending the Raw HTTP Request information however; when trying to read the response I get "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." Here is the code I am using Public Function PerformGetRequest() As String ...

how to implement an implement Buffer for socket send/recv ?

i need a Buffer class for socket send/recv : 1.memmove/memcpy as less as possible 2.object creation as less as possible 3.the class user need no worry for the extend issue is there anything liks that in the standard library ? or how can i make one ? i wrote this but i can't use it for socket, because the buffer(from the standard library...

Getting gateway to use for a given ip in ANSI C

I have looked around like crazy but don't get a real answer. I got one example, but that depended on the individuals own library so not much good. At first I wanted to get the default gateway of an interface, but since different IP's could be routed differently I quickly understood that what I want it get the gateway to use for a given ...

casting to Arrays in Python ctypes

I'm trying to convert a 16 byte blob of data returned by socket.inet_pton into a ctypes array of unsigned bytes. My data structure looks like this: class in6_addr(ctypes.Structure): _fields_ = (("Byte", ctypes.c_ubyte * 16),) And the blob is just: data = socket.inet_pton(socket.AF_INET6, "2001::3") However, these attempts get...

Can C# socket.select return more than one sockets

Hi, I wonder if Socket.Select from .Net can return an IList of two or more elements. So far in my testing, they always return one element after the other (Socket.Select is inside a loop). May I know what kind of testing that you did to be able to return two or more elements? ...

Will PHPs fopen follow 301 redirects?

We have a piece of legacy code that (ab)uses fopen() calls to resources over HTTP: @fopen('http://example.com'). We want to move example.com to another host and then send 301 Permanently Moved. However, we are not entirely sure if @fopen() will follow this. Initial tests show me that it does not. But maybe I miss some configuration pie...