Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Go Back  Xtreme Visual Basic Talk > > > Stack Overflow In VB.Net Possible?


Reply
 
Thread Tools Display Modes
  #1  
Old 04-22-2009, 07:16 PM
AgentSmithers AgentSmithers is offline
Contributor
 
Join Date: Jan 2005
Location: SOCal
Posts: 492
Default Stack Overflow In VB.Net Possible?


Code:
Imports System 'Debug Const Defined in Build Options for "Release"
Imports System.Net
Imports System.Net.Sockets
Imports System.Runtime.InteropServices


Public Class Form1
    Public SWETCPListener As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    Public SWETCPConnected As Socket

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Debug.Print("CreateSocketsCalled")
        SWETCPListener.Bind(New IPEndPoint(Dns.GetHostEntry("127.0.0.1").AddressList(0), 6666))
        SWETCPListener.Listen(0)
        SWETCPListener.BeginAccept(AddressOf SWEPrinterSocket, SWETCPListener)
    End Sub

    Private Sub SWEPrinterSocket(ByVal ar As System.IAsyncResult)
        Try
            Dim MyBytes(1024) As Byte
            Dim MyBytesReceived As Integer
            Dim MyRecievedData As String
            SWETCPConnected = SWETCPListener.EndAccept(ar)
            MyBytesReceived = 1
            While MyBytesReceived <> 0
                Try
                    MyBytesReceived = (SWETCPConnected.Receive(MyBytes, Net.Sockets.SocketFlags.None))
                    If MyBytesReceived > 0 Then
                        MyRecievedData = System.Text.Encoding.ASCII.GetString(MyBytes, 0, MyBytesReceived)
                        Debug.Print(MyRecievedData)
                        Array.Clear(MyBytes, 0, MyBytes.Length)
                    End If
                Catch ex As Exception
                    'msgbox(ex.Message)
                End Try
            End While
            ''msgbox("I got" & MyBytesReceived)
            SWETCPConnected.Close()
            SWETCPListener.BeginAccept(AddressOf SWEPrinterSocket, SWETCPListener)
        Catch ex As Exception
            Debug.WriteLine("EXCEPTION: SWEPrinterSocket: " & ex.Message)
        End Try
    End Sub
End Class
Using such code something close to it in VC++ seeing that the Function never really Returns to clear its "Stack" I just want to confirm that this is safe in DOTNET that If I connect and disconnect from it 1000times without ever letting that Thread ever return from its initial starting function that Im not going to Recv a Stack Overflow?
__________________
Http://ControllingTheInter.Net
My General Computer Forum, From Security To Programming And Back To Troubleshooting.
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
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible? Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
 
Stack Overflow In VB.Net Possible?
Stack Overflow In VB.Net Possible?
 
-->