TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
Go Back  Xtreme Visual Basic Talk > > > TCP - Ident issue. Also am i duplicating code.


Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2011, 02:23 PM
Coel's Avatar
Coel Coel is offline
Regular
 
Join Date: Feb 2011
Location: UK
Posts: 54
Default TCP - Ident issue. Also am i duplicating code.


Hello, By sending an ident response my client has gone from 8 seconds to some times well under 1 second connection time but i am still getting no ident response.

My private members

Code:
#Region " Private Members "
    Private _client As TcpClient
    Private _clientListener As TcpListener
    Private _stream As NetworkStream
    Private _streamWriter As StreamWriter
    Private _streamReader As StreamReader
    Private _pingTime As DateTime
    Private _mtIRC As Thread
#End Region
Now here i call my public sub to provide authentication.

Code:
    Public Sub InitializeThread()
        Try
            _client = New TcpClient(ConnectionInformation.Server, ConnectionInformation.port)
            _stream = _client.GetStream()
            _streamReader = New StreamReader(_stream)
            _streamWriter = New StreamWriter(_stream)
            _pingTime = DateTime.Now
            _mtIRC = New Thread(AddressOf InitializeConnection)
            _mtIRC.Start()
        Catch ex As SocketException
            Exit Sub
        Catch ex As Exception
            Throw
        End Try

        _clientListener = New TcpListener(IPAddress.Any, 113)
        _clientListener.Start()

        Dim client As TcpClient = Nothing
        Dim stream As NetworkStream = Nothing
        Dim sr As StreamReader = Nothing

        client = _clientListener.AcceptTcpClient
        stream = client.GetStream
        sr = New StreamReader(stream)

        _clientListener.Stop()

        ServerWrite(String.Format("USER {0} {1} * :{2}", ConnectionInformation.UserName, 0, ConnectionInformation.RealName))
        ServerWrite(String.Format("NICK {0}", ConnectionInformation.ChannelNick))
        ServerWrite(String.Format("{0} : USERID : WINDOWS XP : {1}", sr.ReadLine, ConnectionInformation.UserName))
    End Sub
server write is just streamwriter sending the command and flushing after.

any ideas?
__________________
I think of the company advertizing "Thought Processors" or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery
Reply With Quote
  #2  
Old 12-27-2011, 03:22 PM
Coel's Avatar
Coel Coel is offline
Regular
 
Join Date: Feb 2011
Location: UK
Posts: 54
Default

Resolved but can any one see if i am doing any thing that should not be done or made better.

Code:
    Public Sub InitializeThread()

        Dim client As TcpClient = Nothing
        Dim clientListener As TcpListener = Nothing
        Dim sr As StreamReader = Nothing
        Dim sw As StreamWriter = Nothing
        Dim stream As NetworkStream = Nothing
        Dim response As String = String.Empty

        Try
            _client = New TcpClient(ConnectionInformation.Server, ConnectionInformation.port)
            _stream = _client.GetStream()
            _streamReader = New StreamReader(_stream)
            _streamWriter = New StreamWriter(_stream)
            _pingTime = DateTime.Now
            _mtIRC = New Thread(AddressOf InitializeConnection)
            _mtIRC.Start()
        Catch ex As SocketException
          ' handle error
            Exit Sub
        Catch ex As Exception
            Throw
        End Try

        clientListener = New TcpListener(IPAddress.Any, 113)
        clientListener.Start()
        client = clientListener.AcceptTcpClient
        clientListener.Stop()

        stream = client.GetStream
        sr = New StreamReader(stream)
        response = sr.ReadLine

        sw = New StreamWriter(stream)
        sw.WriteLine(String.Format("{0} : USERID : UNIX : {1}", response, ConnectionInformation.UserName))
        sw.Flush()

        ServerWrite(String.Format("USER {0} {1} * :{2}", ConnectionInformation.UserName, 0, ConnectionInformation.RealName))
        ServerWrite(String.Format("NICK {0}", ConnectionInformation.ChannelNick))
    End Sub
__________________
I think of the company advertizing "Thought Processors" or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery
Reply With Quote
  #3  
Old 01-02-2012, 12:43 PM
Coel's Avatar
Coel Coel is offline
Regular
 
Join Date: Feb 2011
Location: UK
Posts: 54
Default

any one?
__________________
I think of the company advertizing "Thought Processors" or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery
Reply With Quote
  #4  
Old 01-02-2012, 03:38 PM
AtmaWeapon's Avatar
AtmaWeaponTCP - Ident issue. Also am i duplicating code. AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I can't see enough to comment. I don't know what it's trying to do, nor can I see what the thread does. All I know is you're creating an awful lot of things with a Dispose() method but never disposing of them. Some of it's globally available and possibly disposed in other places, but some of it's local as well.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code. TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
 
TCP - Ident issue. Also am i duplicating code.
TCP - Ident issue. Also am i duplicating code.
 
-->