tcpclient

TCP-IP client-server application to manipulate a dictionary

北战南征 提交于 2019-12-20 06:23:52
问题 I am writing a Client-server program. The Server would hold a dictionary, and clients are able to add an update key-values to the dictionary. Suppose a client- 'A' adds an item (1, 111) . When another client- 'B' wants to update the value of (1, 111) , it has to seek a confirmation from 'A' , and vice versa. Kindly, take a look at the following program: using MyClientServerLib; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System

VB.NET writing a telnet client using system.net.tcpclient

徘徊边缘 提交于 2019-12-20 04:28:44
问题 This isn't working for me when I connect to my solaris box The server is sending back ??% does anyone know what i'm doing wrong Imports System.Net Imports System.Net.Sockets Imports System.Text Public Class TelnetClient Private _hostname As String = "myserver" Private _username As String = "user" Private _password As String = "pass" Private _port As Integer = 23 Private _client As TcpClient Private _data As String Private _sendbuffer(128) As Byte Private _readbuffer(128) As Byte Private

.NET NetworkStream.EndWrite() bytes written

无人久伴 提交于 2019-12-20 01:38:39
问题 The MSDN documentation clearly states that: After obtaining the NetworkStream, you can call the EndWrite method to successfully complete the send operation and return the number of bytes sent. Emphasis mine. However, it returns nothing (void): public override void EndWrite( IAsyncResult asyncResult ) Am I missing something, or is this a typo ( EndRead() does return bytes read).? 回答1: You are not missing anything, it is a doc bug. Probably induced by copy/pasting the EndRead article. Where it

TcpClient or HttpWebRequest to Apple TV ending after 30 seconds?

瘦欲@ 提交于 2019-12-19 08:42:13
问题 I'm working on creating an Library in C# to use the Airplay protocol to send Photos and Video to my Apple TV (Specifically working with Generation 3 but hopefully that should not matter for this). https://airlib.codeplex.com/ All of the commands for Airplay are HTTP on port 70 as per this spec: http://nto.github.com/AirPlay.html I have been successful at getting both photos and video to play on the Apple TV, but no matter what I do the AppleTV will only play 30 seconds worth of video. It

How can I wait for a string from a server with IdTCPClient?

…衆ロ難τιáo~ 提交于 2019-12-19 04:34:10
问题 I have a problem with IdTelnet (indy 10.1). I can't read the data from a server in Unicode mode. and now I want to write the telnet terminal with IdTCPClient. The server sometimes send one line and sometimes more and more lines. But there is not a fixed time between sending. Now my problem is that when I must read data from InBuffer. Or when I must use the ReadLn function to read the data from the server, how many times must I run the ReadLn? 回答1: TIdTelnet is a multithreaded component. It

Serializing object ready to send over TCPClient Stream

我与影子孤独终老i 提交于 2019-12-18 17:07:20
问题 I've got a server and client set up using TcpListener and TcpClient . I want to send an object to my server application for processing. I've discovered the using System.Runtime.Serialization and the following documentation, but I didn't want to faff around to find that I'm doing it in long winded way. The question: What is the best way to process and send an object over the TCP stream? Sending and receiving. Here's an example of my object: // Create a new house to send house newHouse = new

Serializing object ready to send over TCPClient Stream

百般思念 提交于 2019-12-18 17:07:03
问题 I've got a server and client set up using TcpListener and TcpClient . I want to send an object to my server application for processing. I've discovered the using System.Runtime.Serialization and the following documentation, but I didn't want to faff around to find that I'm doing it in long winded way. The question: What is the best way to process and send an object over the TCP stream? Sending and receiving. Here's an example of my object: // Create a new house to send house newHouse = new

Identification of clients

£可爱£侵袭症+ 提交于 2019-12-18 07:19:58
问题 I have a server to which multiple clients are connected. I want to identify what is happening with each client. For this, I need some kind of identification for a particular client. TcpClient tcpClient = (TcpClient)client; logger.DebugFormat("Connection obtained with a client {0} {1} {2} ", client.Connected, client.Client.LocalEndPoint,client.Client.RemoteEndPoint); But I need a simple integer number which can be assigned to a client for its identification. And that number increments for

What conditions cause NetworkStream.Write to block?

跟風遠走 提交于 2019-12-18 04:52:28
问题 Will NetworkStream.Write block only until it places the data to be sent into the TCP send buffer, or will it block until the data is actually ACK'd by the receiving host? Note: The socket is configured for blocking I/O. Edit: Whoops, there's no such thing as TcpClient.Write of course! We all understood we were talking about TcpClient.GetStream().Write , which is actually NetworkStream.Write ! 回答1: Unless .net is using something other than winsock, then according to the winsock reference: The

Faster way to communicate using TcpClient?

好久不见. 提交于 2019-12-18 03:34:09
问题 I'm writing a client/server application in C#, and it's going great. For now, everything works and it's all pretty robust. My problem is that I run into some delays when sending packets across the connection. On the client side I'm doing this: NetworkStream ns = tcpClient.GetStream(); // Send packet byte[] sizePacket = BitConverter.GetBytes(request.Length); byte[] requestWithHeader = new byte[sizePacket.Length + request.Length]; sizePacket.CopyTo(requestWithHeader, 0); request.CopyTo