tcpclient

Serializing object ready to send over TCPClient Stream

醉酒当歌 提交于 2019-11-30 15:19:04
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 house(); // Set variables newHouse.street = "Mill Lane"; newHouse.postcode = "LO1 BT5"; newHouse.house

Get underlying tcp connection from HttpWebRequest/Response

♀尐吖头ヾ 提交于 2019-11-30 15:13:57
I am trying to get more information about what is going on when I connect to a website at a lower level than what HttpWebRequest and HttpWebResponse gives me. I am using C#. I would like to be able to see information about the dns lookup and the time it took to establish a connection (if a new connection was established). HttpWebRequest and HttpWebResponse work at a higher level than this and I want to ask if there is a way of getting the underlying TcpClient object (or whatever low level object they use). If it is not possible, then is there a way to grab and manipulate a list of the

Read SSL Certificate Details on WP8

半腔热情 提交于 2019-11-30 14:45:15
I want to read certificate details (e.g. expiration date or CN) for security reasons. Usually there are some properties in network classes available, that allow to check the certificate. This is missing in WP8 implementations. Also I tried to create an SslStream but also there is no way to get any certificate detail like the RemoteCertificate on .net 4.5. var sslStream = new SslStream(new NetworkStream(e.ConnectSocket)); The SslStream is missing everything relating security. So it looks like also BountyCastle and other libraries cannot be able to get the certificate, because the underlying

socket.emit in a simple TCP Server written in NodeJS?

末鹿安然 提交于 2019-11-30 14:21:08
问题 [as you'll see, I don't understand the basic concepts of a TCP server and client very well and probably socket.emit is not even possible, but I'd like to know the best alternative or similar thing...] Socket.io has a beautiful thing to emit events and catch them on the other side, it's in it's first page (http://socket.io). Can I do something similar like that but with NodeJS' regular 'net' module ? If not then what's the equivalent ? I tried: server.js var server = net.createServer(function

Telnet IAC command answering

梦想的初衷 提交于 2019-11-30 14:12:58
问题 I'm trying to negotiate a telnet connection with a socket. The socket is working,but the server is telling me that thing: ÿýÿýÿûÿû login: The ÿýÿýÿûÿû means 255 253 1 255 253 31 255 251 1 255 251 3 I read all the RFC docs but I don't understand what should I respond with to be able to send (string ascii data?) to the server, my wish is to run the login prompt successfully and then send commands to a server like "halt" or something else. Thanks in advance for your answer. 回答1: From RFC 854:

socket.emit in a simple TCP Server written in NodeJS?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 10:25:50
[as you'll see, I don't understand the basic concepts of a TCP server and client very well and probably socket.emit is not even possible, but I'd like to know the best alternative or similar thing...] Socket.io has a beautiful thing to emit events and catch them on the other side, it's in it's first page (http://socket.io). Can I do something similar like that but with NodeJS' regular 'net' module ? If not then what's the equivalent ? I tried: server.js var server = net.createServer(function(socket) { socket.on("connect",function() { socket.emit('test',{msg : 'did you get it ?'}); }); })

Telnet IAC command answering

霸气de小男生 提交于 2019-11-30 09:15:47
I'm trying to negotiate a telnet connection with a socket. The socket is working,but the server is telling me that thing: ÿýÿýÿûÿû login: The ÿýÿýÿûÿû means 255 253 1 255 253 31 255 251 1 255 251 3 I read all the RFC docs but I don't understand what should I respond with to be able to send (string ascii data?) to the server, my wish is to run the login prompt successfully and then send commands to a server like "halt" or something else. Thanks in advance for your answer. From RFC 854 : Since the NVT is what is left when no options are enabled, the DON'T and WON'T responses are guaranteed to

How to establish a SSL enabled TCP/IP Connection in Ruby

孤街浪徒 提交于 2019-11-30 09:01:35
I need to establish a TCP connection with my server which has a SSL enabled port, that I need to access. I need to send a XML file and get the response from the server. Before the SSL was enabled, I was able to get the data from the server using the below mentioned code. require 'socket' myXML = 'test_xml' host = 'myhost.com' port = 12482 socket = TCPSocket.open(host,port) # Connect to server socket.send(myXML, 0) response = socket.recvfrom(port) puts response socket.close Now I have a 'certi.pfx' with which I need to establish a connection, Send my_xml data and get the response. How can this

C# - TcpClient - Detecting end of stream?

不打扰是莪最后的温柔 提交于 2019-11-30 08:34:57
问题 I am trying to interface an ancient network camera to my computer and I am stuck at a very fundamental problem -- detecting the end of stream. I am using TcpClient to communicate with the camera and I can actually see it transmitting the command data, no problems here. List<int> incoming = new List<int>(); TcpClient clientSocket = new TcpClient(); clientSocket.Connect(txtHost.Text, Int32.Parse(txtPort.Text)); NetworkStream serverStream = clientSocket.GetStream(); serverStream.Flush(); byte[]

High performance asynchronous awaiting sockets

拈花ヽ惹草 提交于 2019-11-30 05:26:52
I am writing an app that will require to make hundreds of socket connections over tcp to read/write data. I have come across this code snippet here and I'm wondering how I can make this more robust. This is currently how I am calling the code: foreach (var ip in listofIps) { IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(ip), 4001); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(remoteEP); await ReadAsync(client); } Is there anything wrong with the above, and how can it be optimized such that it runs concurrently? In the code