python,sockets,xmlrpclib,simplexmlrpcserver
Try binding the server to 0.0.0.0 rather than localhost... server = SimpleXMLRPCServer(('0.0.0.0', 9000), logRequests=True) ...
There's no such thing as sending a signal over TCP. Ctrl+C is a terminal generated signal. Assuming you (or the running process) didn't change the terminal's settings, this means that the terminal driver transforms the Ctrl+C key combination into a kill(x, SIGINT), where x is the process group ID of...
node.js,sockets,session-variables
Try this: io.sockets.on('connection', function(socket){ console.log("Connected Socket = " + socket.id) socket.on('disconnect', function(){ console.log("Disconnected Socket = " + socket.id); } } Let me know if that works. EDIT1: Essentially what you were doing was wrong, logically. The callback function associated to a connection was executed after somebody connected, and therefore lost,...
while sending data from server you must be typing Hello then pressing ENTER key which is nothing but \r\n. So client is reading it as Hello\r\n. So you must be getting two characters extra. I hope it works for you. You can check this by looping through input buffer and...
Inital note: ZeroMQ buffers & High-watermark(s) for cross-platform code Well besides both of your original questions, there is one more to be aware of. Buffers and High-Watermark mechanics may be different due to different versions of ZeroMQ-libraries. For example: a unix-based grid-computing service uses the most recent ZeroMQ version both...
windows,sockets,winsock,winsock2
If you are using event handle (a member of the WSAOVERLAPPED structure) you should definitely use two different structures for sending and receiving.
IPAddress hostIPAddress = IPAddress.Parse("178.189.27.85"); Is your computer actually on the public internet? I would expect your computer to have a private IP (eg 192.168.x.y, 172.16-32.x.y, 10.x.y.z) unless it is directly connected to your internet connection. Assuming you're on Windows, use a Command Prompt and run ipconfig, or visit Control Panel...
c,linux,sockets,udp,thread-safety
Are the C functions recvfrom and sendto mutually exclusive? No. They can both be executed by different threads at the same time. sendto() doesn't wait for recvfrom() to read the data. It would place the data into the socket's buffer and return. Multiple sendto() may block for the previous...
What I think is to Save Mat using FileStorage class using JNI. The following code can be used to save Mat as File Storage FileStorage storage("image.xml", FileStorage::WRITE); storage << "img" << mat; storage.release(); Then send the file using Socket and then retrive Mat back from File. FileStorage fs("image.xml", FileStorage::READ); Mat...
ios,objective-c,sockets,chat,real-time
Assuming you've got your server side things setup, you can use Square's Socket Rocket to implement the client side https://github.com/square/SocketRocket If you're using socket.io at the backend, there are plenty of iOS libraries available for those as well. SIOSocket is one such library....
The TFTP protocol has the following flow: Client sends a RRQ or WRQ request from a randomly selected CTID port to port 69 on the server: Client:CTID ------> Server:69 Server replies from a randomly selected STID port to the client's CTID: Client:CTID <------ Server:STID all subsequent packets for that transfer...
For UNIX Sockets; socket.acept() will return socket, (). i.e: An empty tuple. You can get some information about the "client" socket by looking at socket.fileno() for example. For example with a modified echoserverunix.py: $ python examples/echoserverunix.py <registered[*] (<Debugger/* 19377:MainThread (queued=0) [S]>, <EchoServer/server 19377:MainThread (queued=2) [R]> )> <started[server] (<EchoServer/server 19377:MainThread (queued=1)...
Try closing input and output stream on the client side. client = new Socket(serverIPString,Integer.parseInt(serverPortString)); InputStream in = client.getInputStream(); OutputStream out = client.getOutPutStream(); //Do your work with input and output stream..... in.close(); out.close(); ...
Motoko, please grab C language book and check operations priority. And do it regulary, even experienced developers make errors here. And don't write this crazy style, please learn how to write for humans: if (sfd = socket(family, SOCK_STREAM, 0) < 0) return 1; You should instead do something like this:...
Your server should close the socket after the whole file content has been sent. This would cause your recv function to return zero and end the client's receive loop. If you want to keep the connection for some reason, then you would need to send some additional information to the...
No, it isn't possible in Java. Because, you can not modify the return type of a function you override. The Java Tutorials Overriding and Hiding Methods says (in part) An instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and...
Oddly enough starting a new project from scratch using the react-native-cli generator I was able to copy and paste all of my components over to the new project and have everything work perfectly. I am not sure where the problem is but I will assume for now that there is...
From the POSIX standards reference page on select: FD_ISSET(fd, fdsetp) shall evaluate to non-zero if the file descriptor fd is a member of the set pointed to by fdsetp, and shall evaluate to zero otherwise. So exactly what the result of FD_ISSET (which is really not a function but a...
Normal string formatting cannot be used for bytes. I think the way to go about it is - you'd have to first generate a string, format it and then convert it to bytes with appropriate encoding. So the following changes should work change sock.send(b'Hello %s!' % data) to reply =...
javascript,node.js,sockets,socket.io,sails.js
Sails.js sockets use socket.io under the hood. They are merely a "lightweight wrapper" around socket.io connections.
c,linux,multithreading,sockets
(The issue you observe has nothing to do with running on a dual-boot machine.) The code as shown introduces a race by using the address of the same variable for each incoming connection to pass the socket descriptor to the thread function. The race occures if accept() would return faster...
Will the first call to send() return an ECONNRESET? Not unless it blocks for long enough for the peer to detect the incoming packet for the broken connection and return an RST. Most of the time, send will just buffer the data and return. will the next call to...
When sending, you're assuming the data is null terminated: if((send(sockfd, buf, strlen(buf), 0)) < 0){ You should use the count actually returned by the read method, and you shouldn't use fgets() for that purpose. Your receive loop makes no sense. You're calling recv() several times and testing the result...
javascript,angularjs,node.js,sockets
You need to wrap the change of the model (changing properties on the $scope), with $scope.$apply(function() {}) in order to to update the view. var container = angular.module("AdminApp", []); container.controller("StatsController", function($scope) { var socket = io.connect(); socket.on('message', function (msg) { console.log(msg); $scope.$apply(function() { $scope.frontEnd = msg; }); }); }); $apply()...
Call getsockopt() with the option SO_ERROR.
No, it is not possible. Websocket connections are an 'upgrade' based on HTTP, an HTTP is based on TCP/IP. So, inherently, you cannot open a UDP connection, since for even getting a websocket connection started, you will already have a TCP/IP connection going. However, if you really do need UDP,...
You can either use socket.close() or socket.terminate() to close the connection.
The HTTP protocol requires all header lines to be ended with CRLF and an empty line to follow. You have all header lines without any line breaks. char message[] = "GET http://www.nasa.gov/index.html HTTP/1.1" "Host: www.nasa.gov" "Accept: */*" "Accept-Language: en-us" "Connection: keep-alive" "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"; This...
Redis would probably be fastest, especially if you don't need a durability guarantee - most of the game can be played out using Redis' in-memory datastore, which is probably gonna be faster than writing to any disk in the world. Perhaps periodically, you can write the "entire game" to disk....
javascript,sockets,google-chrome,udp,google-chrome-app
François Beaufort's now deleted answer provided a useful suggestion, sadly in a way that was more appropriate for a comment. I'm making this a community wiki so that he does not feel robbed of reputation. The HOST part indicates which interface you're listening on for data. Setting it to 127.0.0.1...
This is not a proper response: [ 'pBtWJZqN23xAJw0sAAAE', 'test' ] [ 'GPnwtq3gi9t1RZcCAAAD', 'Lobby' ] [ 'n7tTlvoH1M7foT3ZAAAC', 'Lobby' ] Let me guess it is actually: [['pBtWJZqN23xAJw0sAAAE', 'test'], ['GPnwtq3gi9t1RZcCAAAD', 'Lobby'], ['n7tTlvoH1M7foT3ZAAAC', 'Lobby']] If it is not, then correct me. Just iterate through the array and collect values: var values = []; for...
Well, bin_prot is just a serialization protocol, and doesn't depend on whatever you're using for a transport layer. Basically, to serialize a value to string, you can use Binable.to_string function (or Binable.to_bigstring). It accepts a packed module. For example, to serialize a set of ints, do the following: let str...
CloudFlare can't proxy websockets right now for anyone other than an Enterprise customer (we're rolling out broader support later this year). Unless it is going over one of these ports we supportright now, then it needs to be on a subdomain we don't touch (this would also mean the SSL...
sockets,networking,tcp,labview,robotics
A couple of points: Did you get the provided desktop GUI working? That's always the first step. The pic is helpful, but we need to know what you are trying to send (i.e. the data). What you are trying to send should be a command from what I called the...
javascript,node.js,sockets,sails.js
Correct me if I misunderstood something but I think your logic is wrong. I assume Bill is also an account, but when you add only his name you don't have any connection with his account information and also can identify him only by a name. In order to have some...
Everyone that said not to close the stream was right. The reason I kept closing the stream was because the receiving software would then process my message. But the receiving software would also process my message if it was wrapped in the ASCII "STX" and "ETX" characters. My ultimate problem...
Many errors in the C++ code - like if (bytesSent = 0), which is an assignment with result cast to boolean, so always returning false. You don't pay attention to number of bytes read from a TCP socket, assuming that you receive one complete message as you sent it -...
See: http://php.net/manual/en/function.socket-recv.php The MSG_WAITALL flag will block until it has received the full length of the buffer. Which you have specified as 2048 bytes of data....
Use IPAddress.Any to listen. This seems to be your goal: //listen on all local addresses The listening address you have specified is invalid for some reason. There is no need to specify a numeric address....
java,sockets,http,post,request
The code you have shown is not the correct way to read HTTP requests. First off, Java has its own HttpServer and HttpsServer classes. You should consider using them. Otherwise, you have to implement the HTTP protocol manually. You need to read the input line-by-line until you reach an empty...
The simple solution is to ignore the generic parameter when adding the Promise to the dictionary. This can easily be done by either inheritance or interfaces, depending on your needs (for example, Task<T> inherits from Task). Unlike Java, you can't simply use Promise<?> like you're trying to. For example: public...
This question seems not specific to sockets, but to global variables in general. If you need to create a global variable (a socket, in this case) which must be accessible by multiple compilation units: You define the global variable in one single compilation unit (i.e. one cpp file) You declare...
The problem is that your server is listening on localhost ::1 but you are trying to connect to 2015:cc00:bb00:aa00::2 which is a different Interface. Try setting HOST = "::" in your server in order to have it bind to all interfaces.
As per request of the OP some information about using TcpClient and even TcpListener in case you need to create a server as well. Following link will help you get started with using TcpClient :https://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 or this one in code project covers both client and server: http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C in that code...
Remove the (undocumented?) _socket option and change the host value: var client = mysql.createClient({ user: '(your user here)', password: '(your password here)', host: '192.168.12.166', port: '3306' }); However, this assumes that the MySQL database on 192.168.12.166 is configured to accept TCP connections (see the answer to this question on how...
android,sockets,android-broadcast,android-intentservice
IntentService is the wrong choice for this behaviour. You should use a regular Service and manage the threads and connections yourself. You can then send data from an Activity to the Service either by calling startService() with an Intent containing the data, or you can have your Activity bind to...
You could try setting the timeout for the socket should fit your requirement if I understand correctly that you just need to wait one time for 20 seconds. s.settimeout(20) reply = s.recv(4096) Python Socket settimeout() However you are not guaranteed to get all the data packets delivered at once. So...
The client doesn't get to cause arbitrary events to fire on the socket. It is always a message event. Using the same client, try this server code in your connection handler: socket.on('message', function(data) { // data === "pressed", since that's what the client sent console.log("Pressed!"); socket.close(); }); ...
For your function to work at all, you'll need to use references to TcpSocket for the input argument as well as the return type. Also val needs to be T const&, not T&. template<typename T> TcpSocket& operator<<(TcpSocket& sock, T const&val) { unsigned char bytesOfVal[] = //parse bytes of val here......
Mixing binary and text modes on the same stream is tricky. You would be advised not to do it. Using DataInputStream (for the name, count and file content) is one possible solution. (And that is what I would try). Another would be to encode the file content as text (e.g....
java,multithreading,sockets,arraylist
This happens because you try to read twice from the data stream by calling inData.readUTF() method. First call successfully reads data from the stream, but instead of saving result you try to perform another read 2 lines below. readUTF() is blocking method and thus it waits for another portion of...
python,sockets,proxy,zeromq,publish-subscribe
I found the solution for this problem, and even though I read the docs front to back and back to front, I had not seen it. The key is XPUB_VERBOSE. Add this line to after the backend initialisation and everything works fine backend.setsockopt(zmq.XPUB_VERBOSE, True) Here's an extract from the official...
Can it be applied to asynchronous client that can talk to one single server? And could it be a good choice? REQ/REP is not recommended for traffic going over the Internet. The socket can potentially get stuck in a bad state. The DEALER/REP is for a dealer client talking...
java,multithreading,sockets,messenger,instant
Althoug a bit too broad for SO, I will give you a strategy for how to deal with this kind of server-client programs. For more information just hit your favorite search machine. There must be tons of articles. The basic strategy of a server handling multiple client requests is this:...
Yes you can create multiple sockets in order to communicate with clients concurrently. See associated links for sample code. Whether or not your application will be a client or a server will depend on how the price checker expects to be communicated with. To make your life easier, focus on...
Try using disconnect method from the socket object, something like this: io.on('connection', function(socket){ //temp delete socket socket.disconnect(); console.log(io.sockets.connected); socket.emit("test"); }); UPDATE: For example if your HTTP server gives to a client a token: app.post('/api/users', function (req, res) { var user = { username: req.body.username }; var token = jwt.sign(user, secret,...
java,python,mysql,sockets,server
I can't see that you sending image size before sending the image, but in Python code you're reading 4 bytes image size first. You need to add sending of image size in your Java code: try { OutputStream outputStream = client.socket.getOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ImageIO.write(bufferedImage, "png", byteArrayOutputStream); //...
The while (alreadyread != 5) seems extraneous since alreadyread will be 5 or nowread will be less than 0 after the do-while, and if nowread is less than 0 you exit. You've poorly defined a command, I think we need more information on that. It looks like you're getting a...
Because: unlink(TS_SERVER); You remove the existing socket file, which allows a new one to be created in its place....
c,sockets,segmentation-fault,shellcode,experimental-design
This doesn't work because shellcode file is an object file. It is an intermediate file format meant for linker consumption. Treating it as a sequence of instructions is plain wrong. Object file contains code, among other things. However this code is incomplete. When a code references a symbol, like write,...
python,sockets,tcp,multicast,dup2
After os.dup2() call both file descriptors (FDs) refer to the same socket, thus sharing its buffers. When data is extracted (via recv() or read()) using original FD, this fragment can no longer be extracted using duplicated FD, and vice versa. Each octet of incoming data will be read exactly once...
It looks like you are trying to open the port each time just to block the application until data is available. Do not try reopening the port. instead let the read function do the waiting Best way to wait for TcpClient data to become available? byte[] reap = new byte[2048];...
inet_addr() returns an in_addr_t, not an u_long. struct sockaddr_in's sin_addr is a struct in_addr, which holds an in_addr_t s_addr. This should do the trick: static struct sockaddr_in remote_server; remote_server.sin_addr.s_addr = inet_addr(remote_servername); ...
An obvious example is the case of running a service on a multihomed machine. Maybe you want a different key for the sshd on each ip address. Or totally different web servers all listening on port 80 but different addresses. You get the idea. I can't see why it would...
You could just set fdMax to the maximum file descriptor value supported by your system (which may be represented by FD_SETSIZE), and not worry about it, but it may cause inefficiencies. select will use the fdMax value as a hint of when it can stop its linear scan of the...
Try to modify String sender = "GET /docs/ HTTP/1.1\n" + "Host:localhost:8080\n"; with String sender = "GET /docs/ HTTP/1.0\n" + "Host:localhost:8080\n"; HTTP/1.1 is using keepalive by default, this may be related to your problem. Last resort you can try to send a Connection: close header...
while(getline(ss, tok, ',') && i < 16 ){ matrix[i] = static_cast<float>(::atof(tok.c_str())); i++ ; } Since you never reset i, matrix will never be updated after the first time. The recv is fine....
That happens when you have Client connected and then It disconnects and you are trying to read from it. I handle this asking the length of the message, If it is negative, I restart the connection. E.G. //CLIENTS LOOP while (true) { ... //MESSAGE LOOP while ( true ) {...
linux,windows,sockets,network-programming,raspberry-pi
InputStream input = client.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(input)); Your problem is here. You can't use multiple inputs on a socket when one or more of them is buffered. The buffered input stream/reader will read-ahead and 'steal' data from the other stream. You need to change your protocol so...
This depends on how exactly write_message and on_message are defined. For many protocols implemented on top of the Tornado IOStream including Tornado's WebSocketHandler, a queue would not be necessary for a 1:1 pairing because IOStream.write has an internal FIFO buffer and so individual writes are atomic. However, if write_message internally...
The argument to socket.recv() is the maximum number of bytes that the call will return, and there's no guarantee that you'll actually get that many on any given call: while file_size > 0: work_file = server.recv(1024) f.write(work_file) file_size -= 1024 print file_size If you receive fewer than 1024 bytes on...
c#,sockets,buffer,streamwriter
Instead of this byte[] buffersend = new byte[client.ReceiveBufferSize]; buffersend = GetBytes("00010002000B0300010004C380"); int bytesSend = nwStream.Read(buffersend, 0, client.ReceiveBufferSize); nwStream.Write(buffersend, 0, bytesSend); I think you just want this. byte[] buffersend = GetBytes("00010002000B0300010004C380"); nwStream.Write(buffersend, 0, buffersend.Length); There is no need to new up an array just to replace it with the results of...
javascript,sockets,websocket,jetty
From client side you are connecting to some web socket. If port (9995 in your case) is available to connect to then it means that some program (in server mode) is listening and responding. And does something - answers with some data. So, you can connect to such program if...
Disagree with Galik. Better not to use strcat, strncat, or anything but the intended output buffer. TCP is knda fun. You never really know how much data you are going to get, but you will get it or an error. This will read up to MAX bytes at a time....
python,sockets,web-hosting,host
I have temporarily hosted a FB app on pythonanywhere for free and it worked like a charm. In case you plan to use Django, the version they offer usually lags behind. In that case, I'd higly recommend using Openshift, by RedHat....
Typically the things that cause a socket to close are: the client closes the socket the server closes the socket, possibly due to a timeout the server shuts down and issues a reset, either before shutdown or after restart, which closes the socket a firewall times the connection out and...
In Java, DataOutputStream.writeDouble() converts the double to a long before sending, writing it High byte first (Big endian). However, C#, BinaryReader.ReadDouble() reads in Little Endian Format. In other words: The byte order is different, and changing one of them should fix your problem. The easiest way to change the byte...
python,c++,sockets,unix,unix-domain-sockets
Your C++ doesn't do quite what you think it does. This line: strncpy(addr.sun_path, UD_SOCKET_PATH, sizeof(addr.sun_path)-1); Copies a single null character '\0' into addr.sun_path. Note this line in the manpage for strncpy(): If the length of src is less than n, strncpy() writes additional null bytes to dest to ensure that...
No. You can only use streams on the channel socket if the channel is in blocking mode, in which case you wouldn't have a SelectionKey.
The problem is that your parent process is trying to do two different things that need waiting: "barber sleeps until someone wakes him" accept() Without some kind of joint waiting, this architecture does not work. Both pieces of code sleeps waiting for a single kind of event, disregarding the other...
python,sockets,python-3.x,serversocket
There are two issues in your server/client programs. You server has two accept() calls, before the while loop and inside the while loop , this causes the server to actually wait for two connections before it can start receiving any messages from any client. The socket.sendall() function takes in bytes...
php,mysql,sockets,drupal,drupal-7
Check whether mysql is running with the following command: mysqladmin -u root -p status And if not try changing your permission to mysql folder. If you are working locally, you can try: sudo chmod -R 755 /var/lib/mysql/ Reference Connect to Server...
sockets,websocket,client,server,haxe
What you are looking for is Haxe Remoting, which is part of the Standard Library Haxe remoting is a way to communicate between different platforms. With Haxe remoting, applications can transmit data transparently, send data and call methods between server and client side. relevant sources: http://haxe.org/manual/std-remoting.html http://api.haxe.org/haxe/remoting/ As side note,...
c,linux,sockets,linux-kernel,bpf
In my setup, which is based on Fedora 21, I use very similar steps to those you linked to compile and install the latest kernel. As an additional step, I will do the following from the kernel build tree to install the kernel header files into /usr/local/include: sudo make INSTALL_HDR_PATH=/usr/local...
python,sockets,subprocess,tor,proxy-server
The issue is in DownloadYP.py - You do not have the files - C:\\rrr\japan\limit.txt I would suggest creating a dummy file in the above directory with that name, and try running the script again. Also, on a side note - You are mixing the os path separaters from unix and...
You want to create a Web server that will process GET and PUT requests? You first need to read how the http works. Let me explain in simple terms. Try to develop your server first and connect it to a browser : 1.Make your server listen on port 80 -...
c#,sockets,listener,tcpclient,tcpserver
In your screenshots, PC is a master device (it opens a listening server socket), and the sensor is a slave. While your code assumes, that PC tries to connect to a sensor as a client. The minimal code snippet is this: var listener = new TcpListener(IPAddress.Any, 3000); listener.Start(); using (var...
python,multithreading,sockets,popen
The issue could be that some exception is getting thrown before the process can close the connection. You should try the below suggestion and check if that is the case. You should make it a habit to write the code to close connections in a finally block, something like -...
sockets,haskell,network-programming,io-monad
The idiomatic way to repeat the same action over and over again forever is forever serverLoop :: Socket -> IO () serverLoop sock = forever $ do (conn, _) <- accept sock forkIO $ handleConn conn ...
I think using a buffer per connection would be OK in your case. It may however be more elegant to create a buffer per incomplete message. That would mean that you somehow have to know when your message is done, so you would need a small protocol, such as using...
could you make your server log for heartbeats? and also post heartbeats to the clients on the socket? if so, have a monitor check for the server heartbeats and restart the server application if the heartbeats exceed the threshold value. also, check for heartbeats on the client and reestablish connection...
python,sockets,networking,tcp,udp
Answering your last question: no. Because: If client is behind NAT, and the gateway (with NAT) has more than one IP, every connection can be seen by you as connection from different IP. Another problem is when few different clients that are behind the same NAT will connect with your...
sockets,exception-handling,sml,smlnj,keyboardinterrupt
You've hit a pretty big limitation with Standard ML per se, which is that the standard language does not make any provisions for concurrent programming. And you need concurrency in this particular case. Luckily, you're using SML/NJ, which has some extensions that allow concurrency support — continuations. In SML/NJ, you...
java,spring,sockets,spring-integration
We should probably change that to propagate the exception, but it would be a behavior change so we'd probably have to do it in 4.2 only, unless we make it an option. Actually, after further review; this can't be accommodated - you have to handle the exception via the connection...