Questions tagged [system.net.sockets]
65 questions
5
votes
2 answers
GetHostEntry vs GetHostAddresses
I've been trying to find the correct situtation when to use GetHostAddresses or GetHostEntry. I understand by reading this article (http://msdn.microsoft.com/en-us/library/ms143998(v=vs.110).aspx) that GetHostEntry will do the reverse dns lookup…

user384080
- 4,576
- 15
- 64
- 96
4
votes
2 answers
How to tell how much data is in a Socket's send buffer
I can tell how much data is in a Socket's receive buffer by calling Socket.IOControl(IOControlCode.DataToRead, null, outValue);
Is there an equivalent to tell how much data is in a Socket's send buffer?
I need to send as many UDP packets as possible…

tomfanning
- 9,552
- 4
- 50
- 78
4
votes
1 answer
System.Net.Sockets.SocketException when create a websocket connection
iam new in websocket. I have created a console application in .net 4.5 framework and create a sample websocket client using library "WebSocketSharp". I have following code
using System;
using WebSocketSharp;
namespace WebsocketTest
{
class…

Abdul Manaf
- 4,933
- 8
- 51
- 95
4
votes
1 answer
C# SuperSocket without protocol
The question is simple: I've read the whole SuperSocket documentation but I don't understand if there is a way to use it without implement a protocol.
I don't need to send specific commands but only bytes which might be one or hundreds, depending…

tedebus
- 978
- 13
- 20
3
votes
3 answers
Would Asyncronous TCP networking be a better option for a dedicated server with up to 32 players playing at the same time in C#?
Currently I'm planning to design a dedicated server in C# for an XNA game where up to 32 players will be able to connect at the same time. I have had experience in networking with System.Net, but I've not had to deal with quite a large player count…

seandewar5
- 299
- 1
- 3
- 10
3
votes
1 answer
How to achieve a "peer-to-peer" connection with TCPClient/TCPListener in System.Net.Sockets C# (NAT Traversal, no portforward, hole punching)
Preface:
This question is acting as an aggregation of what I've learned so far about this subject. It seems to not be discussed that much (maybe because it's not used that often?).
The only other existing posts are several years old and have few…

Andrew900460
- 621
- 1
- 6
- 16
3
votes
1 answer
How to get length of data received in socket?
Pre:
I have client and server. I send some data from client (win forms) to the server (console). I send data using this on the client:
try {
sock = client.Client;
data = "Welcome message from client with proccess id " +…

Sharikov Vladislav
- 7,049
- 9
- 50
- 87
3
votes
3 answers
How do I re-use TCP Client?
I've had troubles with System.Net.WebRequest and System.Net.HttpRequest in terms of compatibility with multi-threading and socket consumption. I've attempted to go a level lower and roll my own dirt simple Http classes.
Since the problem before was…

James
- 2,445
- 2
- 25
- 35
3
votes
1 answer
Why does FtpWebRequest throw a WebException exactly at the end of a long transfer?
I am trying to connect to an FTP server and download a file but I am having some trouble.
Originally I used WebClient.DownloadFileAsync and it worked fine for a small file but a large file would reach the end of the download but never call…

Dave Williams
- 2,166
- 19
- 25
2
votes
0 answers
Occasional drop of connection with Socket exception 0x80004005
I'm experiencing a problem of randomly getting cryptic errors when receiving data with the TCP server that I've written.
The exception is the following:
System.Net.Sockets.SocketException (0x80004005): An established connection was aborted by the…

nowave7
- 33
- 5
2
votes
0 answers
Will UDP packets merge on receive?
As part of a game I'm developing a server is receiving UDP packets from up to 8 players at around 18 packets per second. All these packets are received by one UDPclient on the server end. I'm wondering if UDP packets can merge the same as TCP…

Isaac Phillips
- 57
- 1
- 6
2
votes
1 answer
system.net.sockets and windows 10 error?
I'm having a very strange problem with an application in windows 10. It consists of several .exe in the same computer communicating between them with sockets using system.net.sockets library.
The problem I have is that after installing Windows 10 in…

Shar-Tel
- 21
- 1
2
votes
1 answer
Error: "System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host" on test server
I am facing an issue where my Web API is working fine on local systems but creating issues when deployed on server. I have checked, cross-checked multiple times to see if I have missed anything from the config, but everything is in order.
Below is…

Amit Verma
- 29
- 1
- 1
- 6
2
votes
0 answers
NetworkStream read error only in windows 10
I faced an strange error I try only to write and read a stream buffer , but when trying to read it raise SocketException.
This is my code:
// create tcp client
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient("",…

Ionut P
- 21
- 3
2
votes
1 answer
Why does socket.BeginConnect() always succeed even if there is no server
Why does Socket.BeginConnect() always succeed? I've made the following code to illustrate my point, if you run just this code there is no server listening, nothing it can possibly connect to and yet it works without problem.
private static Socket…

Vincent
- 1,497
- 1
- 21
- 44