Jump to content

Read C# TCP connection details?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
itsjinx

itsjinx

    Newbie

  • Members
  • Pip
  • 2 posts
I have a program by me written in C# and I want to be able to see what it is sending/receiving to its home website in the background upon loading and possibly block its Data packets to it's main website. Is this possible?

#2
chris cairns

chris cairns

    Newbie

  • Members
  • Pip
  • 1 posts
To connect to a server you need to

1. Using directives

using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Net.Mail;

2. Create a tcp client object


TcpClient Client;

3. Instantiation

Client = new TcpClient();

4. Establish / open a Connection

Client.Connect("SERVERNAME", Port# );

5. Log on to server, to do this we need a method for transmitting data over the open connection to the server. We will use Stream Readers / Writers for this.

5.a Create Data Transport Stream object

NetworkStream stream = Client.GetStream();

5.b Create Data Transport objects

StreamReader reader;

5.c Attach Transport objects to stream

reader = new StreamReader(stream);

5.d Use transport objects to log in

#3
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Nice code, but please use CODE tags. Also, the code is unfinished. What are you going to do with the StreamReader? Read the file or not? And what about imcluding System.IO to cater for it?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#4
itsjinx

itsjinx

    Newbie

  • Members
  • Pip
  • 2 posts
no you completely misunderstood the question. there is a 3rd party program( i have no access to source code) and I want to block it's access to the internet and read what data packets it is sending to the internet. please advise!