• (3 Pages)
  • +
  • 1
  • 2
  • 3

P2P Connections VB.NET Rate Topic: ***** 5 Votes

#31 Guest_starmoon*


Reputation:

Posted 19 April 2010 - 08:39 AM

Sorry forgot the rest of the script

Dim FILE_NAME As String = "C:\test.doc"
Dim TextLine As String

If System.IO.File.Exists(FILE_NAME) = True Then

Dim objReader As New System.IO.StreamReader(FILE_NAME, System.Text.Encoding.Default)



Do While objReader.Peek() <> -1


TextLine = objReader.ReadLine() & vbNewLine

Client = New TcpClient("127.0.0.1", 65535)

Dim Writer As New StreamWriter(Client.GetStream())
Writer.Write(TextLine)
Writer.Flush()
Loop




Else

MsgBox("File Does Not Exist")

End If
Was This Post Helpful? 0

#32 Guest_Diego*


Reputation:

Posted 17 May 2010 - 08:04 PM

Thank you! sought this information everywhere, but only you had the solution.

The only bad thing is the use of the timer. Try any infinite loop in a BackgroundWorker, at least that worked for me.

Thanks again and excuse my syntax, I do not speak English, I am using a translator ... Regards
Was This Post Helpful? 0

#33 Guest_rention*


Reputation:

Posted 29 June 2010 - 04:50 AM

great....10x a lot :angel: :angel: :angel:
Was This Post Helpful? 0

#34 Guest_jay_s12*


Reputation:

Posted 04 August 2010 - 04:57 PM

Awsom Tutorial,Never saw like this complete tutorial without any mistake + full explain.thanks,i hope ur helping by more tutorial. :bananaman: :smile2:
Was This Post Helpful? 0

#35 Guest_V.noo.B. N.ot.E.nemy.T.oo*


Reputation:

Posted 25 August 2010 - 06:50 AM

Thanks for sharing and everything:

You: Public Class

Private Sub
You.Plus100()

End Sub

End Class
Was This Post Helpful? 0

#36 Guest_hidude*


Reputation:

Posted 21 November 2010 - 01:10 PM

hi, vb is awesome!
Was This Post Helpful? 0

#37 GenuineCodes  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-January 11

Posted 02 January 2011 - 06:17 AM

View PosteLampe, on 20 February 2009 - 04:10 PM, said:

Ok, if I get this to work I will be thrilled, but every time I run it I get this:
Posted Image


Set Timer1.Enabled to False
and then add 'Timer1.Start()' to Public sub Form1_load

Hope this helped!
Was This Post Helpful? 1
  • +
  • -

#38 r0tanddecay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-March 11

Posted 15 April 2011 - 10:32 AM

Okay, everything works out just fine except I have one minor issue.
When I try to make the Message from the StreamReader and put it into a label or textbox, I get a runtime error. It only seems to work when a messagebox is used to display the message. Also, does this need a server app to have communication between two systems on the same network?
Was This Post Helpful? 0
  • +
  • -

#39 Sparko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-April 11

Posted 02 June 2011 - 09:42 AM

Excellent post.
Was This Post Helpful? 0
  • +
  • -

#40 GTTravis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 18-November 11

Posted 16 March 2012 - 02:39 AM

I was looking at this post for reading purposes, i have a question

1. How do you dynamically get the IP address of the person expected to receive this message in order to send it.

For example

if you have several users on network, who all access a database on a sql server, that requires them to login through some application.

NB

My wild suggestion to my question would be to caputre (have) the Receiver's computername and some how pull the ip address, when a message needs to be sent??

Your thoughts

This post has been edited by GTTravis: 16 March 2012 - 02:40 AM

Was This Post Helpful? 0
  • +
  • -

#41 maskinao  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-January 13

Posted 01 January 2013 - 06:15 AM

View Postthe_hangman, on 28 November 2006 - 03:06 PM, said:



hello. this works for me when i use the loop back address (127.0.0.1) but when i try sending it to another computer, it freezes and tells me that the

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.1.104:65535"

why does this occur? any ideas? i need help. thank you!
Was This Post Helpful? 0
  • +
  • -

#42 DotNetDevil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 15-October 12

Posted 02 January 2013 - 09:37 AM

View Postmaskinao, on 01 January 2013 - 06:15 AM, said:

View Postthe_hangman, on 28 November 2006 - 03:06 PM, said:



hello. this works for me when i use the loop back address (127.0.0.1) but when i try sending it to another computer, it freezes and tells me that the

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.1.104:65535"

why does this occur? any ideas? i need help. thank you!



Try adding a timer to reconnect and an ex exception to ignor the connection error and retry to connect.
Also an - on error resume next statement might help ignor the connection error and continue the program. Any questions u can contact me directly through the contact page on www.htd-systems-development.webs.com
Was This Post Helpful? 0
  • +
  • -

#43 jarduz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-May 13

Posted 25 May 2013 - 10:49 PM

Man!!!

Thank you very much, I was trying to understand P2P for .NET all over a week and this post is the best!!!
There are some errors trying to excecute at first time when you use timer at this part:

If Listener.Pending = True Then


There is an error saying that you have to initialize the Listener first, just as look inther picture showed by eLampe. Apparently try to run the code of the Timer before running the form load. Something illogical.

What I did to solve this was just add a TRY like this:

Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Try
            If Listener.Pending = True Then
                Message = ""
                Client = Listener.AcceptTcpClient()

                Dim Reader As New StreamReader(Client.GetStream())
                While Reader.Peek > -1
                    Message = Message + Convert.ToChar(Reader.Read()).ToString
                End While

                MsgBox(Message, MsgBoxStyle.OkOnly)
                TextBox1.Text = Message

                If Message = "Protocolo: Muerte subita" Then
                    Me.Close()
                End If
            End If
        Catch ex As Exception

        End Try
    End Sub



Again thank you very much for this post it was really helpfull.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3