client-server

Save and load image from client to server with django

我的梦境 提交于 2020-01-06 10:54:57
问题 Here is how I send data from the client (coffeescript & dajaxice): imageData = canvas.toDataURL("image/png") Dajaxice.draw.saveImage( @saveImage_callback, {'image': imageData } ) Here is how I save my image on the server (taken from this answer) @dajaxice_register def saveImage(request, image): imageData = re.search(r'base64,(.*)', image).group(1) output = open('image.png', 'wb') output.write(imageData.decode('base64')) output.close() I would like to load the image and send it like so:

While loop fails when socket reading input in java

依然范特西╮ 提交于 2020-01-06 10:38:50
问题 so I am having an issue with reading input from a client. It works completely fine whenever I am using my if statements without the while statements wrapped around it in the server class. Could anybody point me to why this may be failing? Server class: import java.io.*; import java.net.*; public class Server { public static void main(String[] args) throws Exception { Server myServer = new Server(); myServer.run(); } public void run() throws Exception { //Initializes the port the serverSocket

Java Client/Server reading and writing doesn't work and no error

余生颓废 提交于 2020-01-06 07:51:07
问题 Client.java package Client; import java.io.*; import java.net.*; class Client { /* To send string to server use "out.print(data)" To use info sent from server use "in.readLine()" */ int port = 1234; String hostname = "localhost"; String input,output; public void send(String text) { try { Socket skt = new Socket(hostname, port); /*Connects to server*/ BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream())); /*Reads from server*/ System.out.println("Server:" + in

Java Client/Server reading and writing doesn't work and no error

流过昼夜 提交于 2020-01-06 07:50:46
问题 Client.java package Client; import java.io.*; import java.net.*; class Client { /* To send string to server use "out.print(data)" To use info sent from server use "in.readLine()" */ int port = 1234; String hostname = "localhost"; String input,output; public void send(String text) { try { Socket skt = new Socket(hostname, port); /*Connects to server*/ BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream())); /*Reads from server*/ System.out.println("Server:" + in

Server and client in Python and C

萝らか妹 提交于 2020-01-06 06:52:34
问题 I've wrote a simple client code in python, and I'm trying to connect to a simple echo server written in C. I know it shouldn't matter, but for some reason I did manage to connect to a server written in python, but I cannot connect to the C server. Here's the code of the client: import socket import sys import time HOST = 'localhost' PORT = 11000 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) msg = raw_input() s.send(msg) data = s.recv(len(msg)) s.close() print

Broadcasting to multiple clients using TCP connection in Java

梦想与她 提交于 2020-01-06 06:52:17
问题 I am trying to broadcast a message to multiple clients but could not do so. I tried saving the socket connections in an array list and using a for loop, i tried to broadcast the message but only the client who posted the message is receiving the reply from server. Client Code: import java.net.*; import java.util.Scanner; import org.json.simple.JSONObject; import java.io.*; public class TCPClient { public static void main (String args[]) { // arguments supply message and hostname JSONObject

client/server connection error

筅森魡賤 提交于 2020-01-06 04:47:25
问题 i trying to create a client/server chat, but when i run the "client" program it cannot connect to the server , i have been trying but i can't find the error This is server code: #pragma comment(lib, "ws2_32.lib"); #include <sdkddkver.h> #include <conio.h> #include <stdio.h> #include <WinSock2.h> #include <Windows.h> #include <iostream> #include "wind.h" using namespace std; //begi void main() { long answer ; WSAData wsaData; WORD DLLVERSION; DLLVERSION = MAKEWORD(2,1); answer = WSAStartup

Unable to print message from server side to client side before sending any message from client

半城伤御伤魂 提交于 2020-01-06 03:48:08
问题 I have two programs for server and client. My server can connect to multiple client. But the problem right now I am facing is that, I want to display some message from the server side to client side but I am unable to do that. Both the server and client program are provided below. I think the syntax that is preventing me to print the message on the client side is scanf which is used the code of client (second line of the while loop). I am not getting any solution for that about how to display

Find out if a process finished running

空扰寡人 提交于 2020-01-05 23:41:33
问题 I have a server which receives commands from a client and runs them. These commands use one specific batch script, which receives arguments and runs. The script calls an external console application program with these arguments. The arguments can also instruct the script to run multiple instances of the console application, in the background. So, the outcome could be one open CMD , running 3 instances of app.exe , in the background. I wish to know when each one of those processes of app.exe

Use of sqlite on network share

冷暖自知 提交于 2020-01-05 12:10:38
问题 We are using SQLite (Xerial JDBC driver) on a windows desktop based Java application. Now we are moving on to a client-server version of the same application where multiple Java based Swing clients will be connecting to the same SQLite db file on the designated server Windows PC. Please correct me if I'm wrong: Is keeping the SQLite database file over network share the only option to use SQLite in this mode? or is there some other solution that I am missing ? Will using SQLite increase the