sockets

Handling dropped TCP packets in C#

自古美人都是妖i 提交于 2021-02-03 05:59:45
问题 I'm sending a large amount of data in one go between a client and server written C#. It works fine when I run the client and server on my local machine but when I put the server on a remote computer on the internet it seems to drop data. I send 20000 strings using the socket.Send() method and receive them using a loop which does socket.Receive(). Each string is delimited by unique characters which I use to count the number received (this is the protocol if you like). The protocol is proven,

Handling dropped TCP packets in C#

╄→гoц情女王★ 提交于 2021-02-03 05:59:25
问题 I'm sending a large amount of data in one go between a client and server written C#. It works fine when I run the client and server on my local machine but when I put the server on a remote computer on the internet it seems to drop data. I send 20000 strings using the socket.Send() method and receive them using a loop which does socket.Receive(). Each string is delimited by unique characters which I use to count the number received (this is the protocol if you like). The protocol is proven,

Receiving only necessary data with C++ Socket

試著忘記壹切 提交于 2021-02-02 09:45:31
问题 I'm just trying to get the contents of a page with their headers...but it seems that my buffer of size 1024 is either too large or too small for the last packet of information coming through...I don't want to get too much or too little, if that makes sense. Here's my code. It's printing out the page just fine with all the information, but I want to ensure that it's correct. //Build HTTP Get Request std::stringstream ss; ss << "GET " << url << " HTTP/1.0\r\nHost: " << strHostName << "\r\n\r\n"

Socket.io - how to display the lastmessage sent when user is not inside the chat?

橙三吉。 提交于 2021-01-29 22:22:11
问题 i currently have 2 screens an all messages screen which includes all the chats i participated in and a chat screen which is the actual chat itself. In my chat screen i successfully implemented sockets, so when both users are on the chat screen at the same time messages are getting exchanged live. My problem: Example: if user 1 is on the allmessages screen and user 2 is inside the chat. And user 2 sends user 1 a message, user 1's screen does not automatically update with the last message for

Socket.io - how to display the lastmessage sent when user is not inside the chat?

狂风中的少年 提交于 2021-01-29 21:11:20
问题 i currently have 2 screens an all messages screen which includes all the chats i participated in and a chat screen which is the actual chat itself. In my chat screen i successfully implemented sockets, so when both users are on the chat screen at the same time messages are getting exchanged live. My problem: Example: if user 1 is on the allmessages screen and user 2 is inside the chat. And user 2 sends user 1 a message, user 1's screen does not automatically update with the last message for

How to deal with multiple part network chuncks of data?

落花浮王杯 提交于 2021-01-29 21:00:44
问题 I'm writing a network client for a given protocol using TCP and I'm having having some philosophical issues with the overall architecture of the thing. Sometimes it may happen that I don't have the whole request data and I may need to read a few more bytes than what's available at the moment, and I imagine sometimes I can get parts of another request after the one I want. What's the usual approach in this kind of situations? 回答1: TCP sockets are Stream-Oriented. That means that reading them

Script breaks out of function after sending a few packets

孤街浪徒 提交于 2021-01-29 20:43:52
问题 I am writing a python program that sends packets for a specified amount of time. The sending script: import socket import time import networkparam import ray ray.init() transformer_sending_time = 0 final_message_sent = False @ray.remote def send_message(): """ Sends an abnormal measurement to the specified ip address or port number given by the networkparam module Parameters ---------- None, however we can consider the definitions in networkparam as the function args Returns ---------- None "

I'm looking for a working example of a Python socket multi-client chat

时光怂恿深爱的人放手 提交于 2021-01-29 20:42:03
问题 I've been trying to code a server socket that accepts connections from multiple clients, a client socket that allows for a connection to the server and real time exchange of messages between multiple clients. I found only one working example, which doesn't produce any runtime errors, but if Client1 sends out a message, Client2 doesn't receive the message until Client2 sends a message of its own. This makes it very confusing to chat. I'm not sure how to modify the code, so that each time

OpenSSL DTLS connection never establishes

♀尐吖头ヾ 提交于 2021-01-29 20:30:42
问题 I'm sorry for such a big block of code, but I'm so lost as to what is happening, I have no idea where the problem might be... I am trying to get a VERY minimal dtls server going and I can't get the client and server to finish handshaking. Here is my code: #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h>

socket.broadcast.to().emit() vs socket.to().emit()

回眸只為那壹抹淺笑 提交于 2021-01-29 19:59:59
问题 What is the difference between: socket.broadcast.to().emit() and socket.to().emit() Here on the socket.io cheat sheet it says socket.to('game').emit('nice game', "let's play a game"); // sending to all clients in 'game' room except sender Then in this tutorial blog it says: socket.broadcast.to('game').emit('message', 'nice game'); //sending to all clients in 'game' room(channel) except sender socket.to('game').emit('message', 'enjoy the game'); //sending to sender client, only if they are in