client

Java client/server sockets

喜你入骨 提交于 2021-02-10 05:49:09
问题 I'm starting off with java sockets and have strange [lack of] output. Here's my source for the socket methods: Client source code: public void loginToServer(String host, String usnm ) { try { Socket testClient = new Socket(host,1042); System.out.println ("Connected to host at " + host); logString = ("CONNECTED: " + host); outGoing = new PrintWriter(testClient.getOutputStream(), true); outGoing.print("Hello from " + testClient.getLocalSocketAddress()); InputStream inFromServer = testClient

sockets programming: sending and receiving different data to different clients in C

空扰寡人 提交于 2021-02-08 12:02:36
问题 I have written a basic client server code in c socket programming using the TCP/IP protocol but i cant figure out how to make it connect to different clients and send/receive different data to and from them as a function to the client (meaning if its the first client send him that data and if its that client send him the other data) and so on. This is the only results i have found were sending the same data to different clients. Current Server: #include <stdio.h> #include <stdlib.h> #include

Link two computers with Socket in Java

五迷三道 提交于 2021-02-08 09:59:05
问题 I have a server and a client in Java, both work in localhost or with my machine IP, but when I tells a IP from another computer in my local network, it tells "Exception occurred: Connection refused: connect"! Here is my code: ChatClient.java package programmingchat; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; import java.net.UnknownHostException; import java.util

Link two computers with Socket in Java

白昼怎懂夜的黑 提交于 2021-02-08 09:58:53
问题 I have a server and a client in Java, both work in localhost or with my machine IP, but when I tells a IP from another computer in my local network, it tells "Exception occurred: Connection refused: connect"! Here is my code: ChatClient.java package programmingchat; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; import java.net.UnknownHostException; import java.util

Receiving data in packets on TCP client

▼魔方 西西 提交于 2021-02-08 09:55:57
问题 Does recv() call intercepts data in packets or can i get data packets with timestamps? 回答1: On a datagram socket (like UDP), recv gets data in datagrams. TCP is a stream-mode socket, however, and recv gets a collection of bytes with no regard for packets. It's possible, using low-level APIs, to get the packets, but if you were hoping to see boundaries between send calls you are out of luck... that information is not present in the packets. 回答2: Recv gets data from a socket that has been

Receiving data in packets on TCP client

纵然是瞬间 提交于 2021-02-08 09:55:52
问题 Does recv() call intercepts data in packets or can i get data packets with timestamps? 回答1: On a datagram socket (like UDP), recv gets data in datagrams. TCP is a stream-mode socket, however, and recv gets a collection of bytes with no regard for packets. It's possible, using low-level APIs, to get the packets, but if you were hoping to see boundaries between send calls you are out of luck... that information is not present in the packets. 回答2: Recv gets data from a socket that has been

PayPal Smart Buttons returns me JSON error

醉酒当歌 提交于 2021-02-08 05:41:49
问题 I'm implementing Express Checkout Integration in PHP (using PayPal Smart Buttons) but I get an error when I try to pay. The error is triggered when the createOrder function is called. I believe the error lies in the server side, because the fetch is being executed successfully and the server generates an ORDER ID, however it does not properly pass the ORDER ID to the client and I end up with the following error: Error: Unexpected token S in JSON at position 0 I don't know what could be wrong

Python(Server) Android(Client) Socket Programming

∥☆過路亽.° 提交于 2021-02-08 05:14:13
问题 I'd like to make a program which connects Python code with Android Studio. But there has been a problem on android studio which is not showing any UI that I'd like to show on Emulator Screen. I think it is due to "StrictMode". But If I except the StrictMode Code. The Program is stopped. What should I do? Here is the codes. Python Code(Server) import socket import random as r HOST = "localhost" PORT = 9999 x = ['10', '20', '30', '40', '50'] y = ['-10', '-20', '-30','-40', '-50'] rssi = ['1.5',

Python(Server) Android(Client) Socket Programming

瘦欲@ 提交于 2021-02-08 05:13:23
问题 I'd like to make a program which connects Python code with Android Studio. But there has been a problem on android studio which is not showing any UI that I'd like to show on Emulator Screen. I think it is due to "StrictMode". But If I except the StrictMode Code. The Program is stopped. What should I do? Here is the codes. Python Code(Server) import socket import random as r HOST = "localhost" PORT = 9999 x = ['10', '20', '30', '40', '50'] y = ['-10', '-20', '-30','-40', '-50'] rssi = ['1.5',

Quarkus & Microprofile : Is there a better way to use a property from application.properties into @ClientHeaderParam?

孤街醉人 提交于 2021-02-07 14:34:21
问题 I'm trying to build a simple app that calls an API with quarkus-rest-client . I have to inject an API Key as a header which is the same for all resources of the API. So I would like to put the value of this API Key (that depends on the environment dev/qa/prod ) in the application.properties file located in src/main/resources . I tried different ways to achieve this: Use directly com.acme.Configuration.getKey into @ClientHeaderParam value property Create a StoresClientHeadersFactory class