aman729_88
asked on
data sharing between two computers on lan
hi
i have connected two computers with lan one computer does the ocr once in 259ms using vb.net and the data has to be transfered to another vb.net application on the other computer on the same network...
where data will displayed in a textbox.
file sharing is allowed..
can there be a very fast process of data communication...
i am thinking of a text file to communicate or there has to be some method using xml.
cant i ocr and save the textfile on other computer and that computer read it continuosly...
thanks!
i have connected two computers with lan one computer does the ocr once in 259ms using vb.net and the data has to be transfered to another vb.net application on the other computer on the same network...
where data will displayed in a textbox.
file sharing is allowed..
can there be a very fast process of data communication...
i am thinking of a text file to communicate or there has to be some method using xml.
cant i ocr and save the textfile on other computer and that computer read it continuosly...
thanks!
Named pipes might be one you want. They are kind of like shared files but not written to disk and you won't have access problems. VS help has examples.
ASKER
i cannot find the exact coding anywhere
i just want to make a textbox in one application on one computer
if that data changes it should come on the textbox of another computers vb.net application textbox
can u help it out plz
i just want to make a textbox in one application on one computer
if that data changes it should come on the textbox of another computers vb.net application textbox
can u help it out plz
Here is the example from VS Help
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Class PipeServer
Shared numThreads As Integer = 4
Shared Sub Main()
Dim i As Integer
For i = 1 To numThreads
Dim newThread As New Thread(New ThreadStart(AddressOf ServerThread))
newThread.Start()
Next
End Sub
Private Shared Sub ServerThread()
Dim pipeServer As New NamedPipeServerStream("testpipe", _
PipeDirection.InOut, numThreads)
Console.WriteLine("NamedPipeServerStream thread created.")
' Wait for a client to connect
pipeServer.WaitForConnection()
Console.WriteLine("Client connected.")
Try
' Read the request from the client. Once the client has
' written to the pipe, its security token will be available.
Dim sr As New StreamReader(pipeServer)
Dim sw As New StreamWriter(pipeServer)
sw.AutoFlush = True
' Verify our identity to the connected client using a
' string that the client anticipates.
sw.WriteLine("I am the true server!")
' Obtain the filename from the connected client.
Dim filename As String = sr.ReadLine()
' Read in the contents of the file while impersonating
' the client.
Dim fileReader As New ReadFileToStream(pipeServer, filename)
' Display the name of the clientr we are impersonating.
Console.WriteLine("Reading file: {0} as user {1}.", _
filename, pipeServer.GetImpersonationUserName())
pipeServer.RunAsClient(AddressOf fileReader.Start)
pipeServer.Disconnect()
sr.Close()
sw.Close()
Catch ex As Exception
Console.WriteLine("ERROR: {0}", ex.Message)
End Try
pipeServer.Close()
End Sub
End Class
Public Class ReadFileToStream
Private m_filename As String
Private m_stream As Stream
Public Sub New(ByVal stream1 As Stream, ByVal filename As String)
m_filename = filename
m_stream = stream1
End Sub
Public Sub Start()
Using sw As New StreamWriter(m_stream)
Dim contents As String = File.ReadAllText(m_filename)
sw.WriteLine(contents)
sw.Flush()
End Using
End Sub
End Class
ASKER
i am a beginner can there be an unsecured more easy code
just for testing
ex: if i change a value of text box on one computer it should reflect on other computer
just for testing
ex: if i change a value of text box on one computer it should reflect on other computer
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
'NamedPipeServerStream' not defined error is coming at running the above program
That happens when you run it or compile it, and what line?
ASKER
when i press f5 on line no 19
ASKER
Dim pipeServer As New NamedPipeServerStream("tes tpipe", _
PipeDirection.InOut, numThreads)
PipeDirection.InOut, numThreads)
ASKER
a green line is also coming on
imports system.io.pipes
imports system.io.pipes
You might have to add a project reference to the System.Core assembly.
ASKER
it is not there in refrences
i have searched everywhere
i have searched everywhere
Sorry, my mistake. I didn't realize the named pipe classes are only available in the latest framework, which I think means VS 2008 is required. Sockets or remoting would be some other options, but neither is trivial. I'd opt for the file with polling.
ASKER
plz can u tell me one of the techniques
i understand rmi and all
i understand rmi and all
ASKER
but i have never implemented on vb.net can u suggest some examples
ASKER
how can i query sql server persistantly to retrieve the updated data from the database
Polling a database would be a good alternative. You don't have Visual Studio documentation? It will have examples. You would use SqlCommand to run a query, and Timer to periodically invoke the query. Or I imagine google on SqlCommand for one example and Windows.Forms.Timer would get you the other.
ASKER
hi
can u tell me how to write to sql server 2005 using triggers
actually i have data in a variable which i get in every 500ms
i want to enter it on a sql server and as soon as it is added it should be displayed on all vb.net application retreiving the data from that data base
the connection need not be secure
can u tell me how to write to sql server 2005 using triggers
actually i have data in a variable which i get in every 500ms
i want to enter it on a sql server and as soon as it is added it should be displayed on all vb.net application retreiving the data from that data base
the connection need not be secure
ASKER
thank you!