I have a function:
function QuerySMTPServer ([string]$strSMTPServerName) {
# open up a socket to the SMTP server
$socket = New-Object System.Net.Sockets.TCPClient
$socket.connect($strSMTPServerName, 25)
$socket # output for testing
# read response data (should be a line starting with 220; cf. RFC821)
$stream = $...
I am using Unix domain sockets to do some interprocess communication in Linux. Upon connection, the client sends a struct using send to the server. This struct contains some information about the client including an identifier string at the end. The server receives the info just find and sends another struct back. The client blocks with ...
I have a large C#/WPF application. This application needs to collect data from other, "sub", applications that will be running on a Windows service - same network, different PC. Is sockets the best way to handle communications between the two (as opposed to remoting or something else)?
...
Hi,
I read data from a TCP socket connection, but the server sends me \0 from time to time (which would mark the end of a message). Thus, I do not get the rest of the message.
I read like this:
uint8_t buf[tcpBufferSize];
unsigned int len = 0;
len = [inputStream read:buf maxLength:tcpBufferSize];
if(len > 0) {
NSMutableData* dat...
I have written a python script which binds to a socket like this:
from socket import *
addr = (unicode(), 11111)
mySocket = socket(AF_INET, SOCK_STREAM)
mySocket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
mySocket.bind(addr)
I package this script with py2exe using setup.py with the following options:
setup(
console=["myProgram.py"],...
I'm working on a batch system (Torque), now the important part is this: When an interactive job is run, the submit tool will communicate with the execution host. This fails on one of the machines.
Here is the strace output:
Sumbit tool:
16:18:36.219925 fcntl(4, F_GETFL) = 0x2 (flags O_RDWR) ...
I'm looking for a simple way to implement this scenario:
Say I have two machines I'd like to share data between. The location/addresses of these machines can change at any time. I'd like both machines to check in to a central server to announce their availability. One of the two systems wants to pull a file from the other. I know th...
I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server.
I know I need one socket to bind() the server port to so I can accept incoming connections from c...
Why use http(s)+comet and not simply socket programming+maybe use the same port 80 or 443 if firewall/blockage is an issue?
Wait, perhaps because browsers don't have javascript sockets API?
If I am building an independent application and not a web-app, does comet have any advantage over socket programming?
...
Hi,
I’m using C# Socket in synchronized mode (I mean that the socking is blocking and I’m using “Send” and not BeginSend)
I sometimes get “A non-blocking socket operation could not be completed immediately” after sending data
In addition I'm receiving the data using BeginReceive
Does anyone know why I'm getting this exception and what ...
I have the following problem:
I have to write a PHP script that works as a client against another HTTP Server. This Server ignores the HTTP Connection:Close header and keeps the TCP connection open unless it is closed by the client. And here is my dilemma. I (the client) have to deciede when a HTTP request/response has finished and then...
I have a SocketServer.StreamRequestHandler server that calls self.rfile.readline() to read a request and then calls self.wfile.write(data) to send back some data:
class FileServerHandler(SocketServer.StreamRequestHandler):
def handle(self):
# self.rfile is a file-like oject created by the handler
data = self...
I've got some code that:
reads from a ReadableByteChannel into a ByteBuffer,
takes note of the bytes transfered,
pauses a few tens to hundreds of miliseconds,
passes the ByteBuffer onto a WritableByteChannel.
Some details:
Both Channels are TCP/IP sockets.
The total connection read size is in the tens of megabytes.
The sourc...
I am new to both sockets and threads. I have this code:
listen(socket_fd, 20);
/* Looooop */
while (1) {
newsocket_fd = accept(socket_fd,
(struct sockaddr *) &client_addr,
&client_len);
if (newsocket_fd < 0) {
error("ERROR on accept");
}
pthread_t thread;
...
I have been trying to implement the TCP_KEEPALIVE parameter for a C server socket and I can't seem to figure out how to check if the socket is marked as broken. I followed this tutorial for configuring the socket to do the keep alive but it says that "If no ACK response is received for nine consecutive times, the connection is marked as...
Is there a way to convert an integer into a network short integer on the iphone? Also, how do I convert a network short to a host short. In c, it's htons and ntohs
Thanks
...
Hi,
I am trying to write a socket interface for my program and I'm finding that it never triggers the acceptCallback. I have a messageSender.exe that runs fine with messageReceiver.exe. I'm adding the following code to my app and trying to get it to communicate with messageSender.exe, but my program never enters into the acceptCallba...
I have written a TCPIP server that implements a FileSystemWatcher and fills a queue with data parsed from new files acquired by the FSW.
A single client will connect to this server and ask for data from the queue (no other client will need to connect at any time). If no data exists, the client will wait (1 second) and try again.
Both ...
I'm confused as to what is "best" to use when dealing with sockets. The Socket object provides Send/Receive methods (and async equivalents), but also allows a NetworkStream to be created. The only way I've had any joy using Socket.Send is by wrapping the call in a block such as:
using (Stream stream = new NetworkStream(socket)) {
so...
Hello,
I need to implement POP3, IMAP and SMTP servers availability and identity checking by connecting to them, authorizing and comparing expected server output with received server output while doing previously mentioned operations.
I'm using Java, so not to reinvent the wheel, I'm also using javax.mail implementation. Everything wor...