Pass A Class Using TCPClient?

Mar 6, 2009

I have been reading the following thread by perito which was resolved with a great deal of assistance from Athiest.[url]...

Using the sample code in this thread I have now created a Client and Server app which is successfully sending messages over a network between two machines.

Now that I am able to send simple text messages I would like to progress to my intended pratice of sending more complex information between the machines. I have already written a program which generates and stores data with a class which I use as a data type. I would like to be able to pass this class from one machine to another.

View 2 Replies


ADVERTISEMENT

.net - Difference Between New TcpClient(MachineName, Port) And New TcpClient(new IPEndpoint?

Mar 31, 2011

I have a .Net program that has to run on a cluster of server 2008. To find out the right IP I resolve the dns by GetHostEntry(VarDefinedInfConfig).AddressList(0)

but when I am converting my old code (this code picks the wrong IP) dns.GetHostName().AddressList(0) => this returns a virtual IP and not the right one.So I changed my TcpListener to (dns is parameter from config)Dim listener As TcpListener = New TcpListener(New IPEndPoint(Net.Dns.GetHostEntry(dns).AddressList(0), 8001))
listener.Start()

[Code]...

View 3 Replies

Can't Pass Value To A Class

Nov 3, 2009

The value from the text box is not being passed to the class.[code]...

View 13 Replies

How To Pass The Value Between Class?

Feb 16, 2011

Can any one please tell me why the following code is not giving me the expected result Application type as Class library Form with 1 text box and 2 button

form1.vb
Public Class Form1
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cl As New WindowApp.Class1

[Code]...

View 4 Replies

Pass A SqlParameter From One Class To Another?

Oct 19, 2011

I have a class, LogRequest, which contains parameters (members) for an object.This object is turned to an sql query using another class, DataAccess.And lastly, I have the class Search which run the sql query.[code]...

View 2 Replies

Pass Data From Other Class?

Apr 7, 2011

I'm still trying to develop p2p chat application from this thread. I have 2 applications, server and client. A client has: Form1.vb, BB_Client.vb, and RTS_SocketClient.vb. Dataflow is Form1 creates new object of BB_Client, BB_Client calls RTS_SocketClient.[code]...

View 7 Replies

Pass Values From One Class To Another?

Jul 25, 2011

I have a main class named PortaLinhaFrio and a child class named Ambiente [code]...

View 2 Replies

Forms :: Pass A Variable From Within A Class

Jun 25, 2011

i have a class called car and within that class i have a few vairables

Public Class car
Public Property Name As String
Public Property ID As Byte

[Code].....

View 5 Replies

Pass A Function To A Class To Be Called Later?

Dec 11, 2010

Okay so what im trying to do is make a simple particle system in VB (Yes i know this isnt a ideal setup). Im going to have particles dieing and spawning new ones tho, To do this i need to be able to pass a function to the particle when its created then call that function when it dies. Is there a way to do this by passing function pointers?

View 9 Replies

Pass An Object Type To A Class?

Jun 18, 2009

I create a object type entity in the main function and would like to pass it to a separate class, do some calculation, and then pass the result back to the main function. But I keep getting errors, can someone point me where I did wrong? It's in windows application[code]...

View 2 Replies

Pass DataTable Event To Class?

Apr 17, 2012

I have a form that contains a DataTable variable (dt) that has a RowChanged event assigned to it. I use a UserControl (DataGridViewFilterAndSorter) to get a subset DataTable from dt. I need dtSubset to have the same event as dt. How can I do this?

In other words, I need to pass the dt event to the DataGridViewFilterAndSorter class and store that event as a class level variable. How can I do this?

Public Class frmCalculatedResults
Private dfs As DataGridViewFilterAndSorter
Private WithEvents dt As DataTable

[Code].....

View 4 Replies

Create A New Instance Of The Moblist Class Each Pass?

Jan 13, 2011

I have an application that reads another processes memory.I initially had multiple scanning threads for the various areas I needed to read.This was processor intensive so I decided to go with the observer pattern.All was well except that I am having a weird behavior.Here is what is happening.I have 2 radars (overlay and mapped)Both have a watcher class that attaches to the memory scanner and is notified on a new list of mobs.so I open radar 1 (mapped) it attaches it's watcher to the scanner and waits for mob list update notifications

Open radar 2 (overlay). same thing happens and another watcher is attached.all is well and good so far.Now there are properies on the mobs in the list, one of which is IsFilteredOut.This property is set in the radar code after it receives the list. Now the weird behavior is that no matter what I do, the second radar to be opened changes all the properties of the mobs in the list of both radars.It is as if I am passing the list by ref, but I am not.I actually create a new instance of the moblist class every time I pass the list.Here is the notify code. As you can see I create a new instance of the moblist class each pass.

Private Sub NotifyMobListUpdated(ByVal Mobs As List(Of MobData))
If Mobs IsNot Nothing Then
For Each w As Watcher In _watchers[code].....

View 1 Replies

How To Pass Values From List Inside Of Class

May 5, 2011

I am having a hard time trying to pass the values from a list inside of a class. I am trying to display multiple lines of values from a list inside of a class. My "client" class stores multiple lines of values into a list(of class transaction), with the number value (num) counting each transaction that it adds to the list.

Ex:
Public Class Client
Private m_tranlist As New List(Of transaction)
If CInt(tid) = m_ID Then 'create client tran, add to list
nextTran = New transaction(m_ID, tcode, tdate, ttype, tshares, tprice, value, num)
m_tranlist.Add(nextTran)
num += 1
End If

Now I am trying to display each line that is stored in the list in a label, and I am having major trouble. How do I call the list in my main form in order to display all of the values?

View 1 Replies

Pass Code Blocks To A Method Or Class?

Apr 23, 2009

Is there a way to pass code blocks to a method or class?

I'm trying to write a number of exception handling methods.[cod]e...

View 5 Replies

Pass String Output From VB Class To VBA Module Via A COM Add-in?

Dec 11, 2011

I am using an email verification program I have downloaded to test the validity of a given email address.I have setup a class in VB using Visual Studio 2010 with the required code that runs the check.I have then registered this as a COM so I can call it through VBA in Excel.In an excel workbook I have then created a module that calls the VB class. The excel module tests whether the email address typed in cell "A1" is valid or not. At the moment the VB class simply gives me a messagebox output saying "Success" or "Fail" which works fine.What I actually want though is for the "success" or "Fail" message to appear in cell "A2" next to the email address as opposed to the current messagebox output.

View 2 Replies

Reading From Class - Pass The AnalystID And Return The Name

Aug 7, 2009

I'm trying to take a resultset, store in a class then retrieve the complete record for a given value. For example, the recordset has AnalystID (Unique), LastName, FirstName. I want to be able to pass the AnalystID and return the name. I need the ability to look up either last or firstname by analystID throughout the program. Here's what I have so far. I'm not sure I'm even headed in the right direction.

[Code]...

View 4 Replies

Use Form Handle In Class Without Pass It As Argument?

May 3, 2012

I'm writting a class that needs the form handle but there is a way to use it without send it as argument in the class constructor or in a property?I know that the handler is not set until the form is completely loaded so that is another problem too.The basic idea is catch the form handle without pass it as argument and handle the wm messages.

View 2 Replies

VS 2010 Pass By Reference To Constructor Of A Class?

Feb 11, 2012

Implementing a simple MVC in vb. The controller instance creates and holds instances of the model and view:

Public Class Controller
Public Property myModel As Model
Public Property myView As View

[code].....

View 7 Replies

How To Pass Form Object To Data Class For Update

Mar 11, 2009

I am converting some VB6 code which passed an unknown form object to a class, which then used the passed form object to reference the calling form and direct the data from the class as follows:
The Called Class in the class clsGetRecord
Public Function Execute(ByRef FRMForm as form) as booleanFRMForm.List1.Additem(SomeData)....Execute = SomeBool End Function
The clsGetRecord is used by many different forms which receive data all have objects called List1 as: The Calling Form for the form
frmThisFormPrivate function() as booleanDim objRecord as new clsGetRecordbRet = objRecord.Execute(frmThisForm)
The passed form object which will receive dataEnd function. Is there any simple way to do this since the calling form object is unknown at design time?

View 2 Replies

Initialize A New Instance Of A Class, But Pass It To Other Forms Too For A Wizard Based App?

Dec 20, 2011

As an ameture developer, I've never really used classes. However, I've been reading about using classes and automatic properties. I have therefore created a class which looks similar to this:

Public Class Quote
Property QuoteNum as integer
Property AccNum as String
Property Price as Decimal
End Class

The stumbling part for me comes in the way of letting form2 know which class form1 has initialized. There are in this example 3 forms to this wizard. If someone starts another wizard whilst half way through the first wizard we need to keep the variables seperate hence using the class. I think I'm along the right track, but maybe confusing myself a little.

[Code]...

View 12 Replies

Using Delegates To Pass Information Back To UI From Custom Socket Class?

Oct 6, 2010

I am in the process of prototyping a small sockets application, which monitors IT infrastructure (due to in-house financial and deployment restrictions, I am unable to utilise an existing commercial or open-source solution). Basically, I have a server application and associated agent process for communicating heart-beat data to the server. The server application implements a TCP socket class (TCPDevice), which is called from a WinForm. I am aware of the restriction on updating the UI from processes running on separate threads, and that the preferred technique for acheiving this is via the use of Delegates in conjunction with the Invoke method. Having had very little need previously for using Delegates (apart from of course std windows events and the BackGroundWorker control), I am at a loss as to how to do this in the context of my application, and would appreciate some assistance, although it has occurred to me that I could use the backgroundworker for marshalling updates to the UI.

Eventually the application will need to update a grid of devices via feeds from the defined agents, however for the purpose of this exercise simply updating a status bar on the UI will suffice. The section of the code which I believe is relevant to propogating the code to the form is contained in the OnDataReceived method.Below is a code excerpt from the protoype app which should put the above into appropriate context:

Code from the form:

[code]...

View 1 Replies

VS 2008 Pass Error Message From Class To Windows Form?

Aug 13, 2009

I'm trying to program in a true object oriented manner and its causing me to re-learn a few things. Specifically, I'm having some trouble with error handling. I have all of my data access being performed by an adapter class in a seperate project. I can catch duplicate records without any problems, but I want to be able to send a message back to the user. Here's what I have so far:

[Code]...

View 11 Replies

Class Library (dll) Single Instance To Pass Data Between Processes Or Exe's DESIRED BADLY

Oct 20, 2010

The "named pipe" seems rediculous to pass data between processes (exe's). Is it possible to run a single instance of a VB.NET Class Libary (dll) such that two programs can access the same memory resident dll, thereby passing data via functions and or subs?When I try to make the class library as single instance, the "Enable Application Framework" is greyed out, and thus the option to "Make Application Single Instance" is also greyed out.When I try to call the dll from two processes, I simply just create two instances, so storing data in a module doesn't work

View 2 Replies

Pass A Delegate Into A Constructor Of An Abstract Class From A Descendant's Constructor?

Feb 15, 2010

I have an abstract class which requires a delegate to function. I pass the delegate into the constructor. Now that I have a non default constructor I need to call the abstract class's constructors from the concrete class which means that I need to use MyBase.New(...). I have included a quick example below.

Public MustInherit Class BaseClass
Public Delegate Sub WorkMethod()
Private _Work As WorkMethod

[code]....

I have tried to do this but I keep getting the following error: "Implicit reference to object under construction is not valid when calling another constructor".Can I not do what I am trying to do above? I initially had the delegate setup in its own setter method. But then I am creating a deceptive API because it does require a point to a method to work properly.

View 3 Replies

Enabling SSL With TcpClient?

Mar 2, 2009

So how does one turn SSL on in System.Net.Sockets.TcpClient with VB.NET code?

Turning it on in System.Net.Mail.SmtpClient is easy, you set the .EnableSsl property. I cannot find a corresponding property in TcpClient. It's probably buried somewhere.

View 1 Replies

How To Specify An IP Address For TcpClient To Use

May 16, 2011

During development, we usually use localhost as the hostname, like the following

Dim serverListener As New TcpClient("localhost", 8585)

I want the user to be able to enter their IP address via a TextBox instead, like

Dim serverListener As New TcpClient(textbox1.text, 8585)

However, this is not working for me.

View 2 Replies

Tcplistener / Tcpclient Over LAN

Apr 22, 2012

I am creating an application that will be talking over the LAN (and eventually, WAN) which uses the Tcplistener and Tcpclient objects.Now, I have this working absolutely fine locally using the loopack address although when I change the IP of the listener to 0.0.0.0 (listening for all IPs) and the IP in the client application, to the IP of the server, it throws an exception when connecting. The client says something along the lines of the the server has rejected the incoming connection. So i disabled all firewalls temporarily but I still have the problem.I have ran netstat on the server which clearly shows that it is listening for an incoming connection on 0.0.0.0. [code]

View 5 Replies

.net - Working Of Tcpclient Sockets In .net?

Jun 2, 2011

I have an application in vb.net which will connect with an hardware device and test its functionality. The hardware device basically spits out data continuosly through Ethernet. That is it recieves some data via com ports and spits out the processed data via ethernet.So my application does both. Thats pretty much the entire app.My problem is i am using tcpclient sockets. Now when i connect a tcpclient to the device using

tcpclient.open(ip,port);

Immediately the device sends some data which comes and get stored in the clientsocket. Then i send a command to it ,only then i read the data from the clientsocket using

tcpclient.getstream().read()

at this time the entire data that is the one which flowed immediately when connected to the device and the one that i actually need after passing command is both acquired. This is undesirable. I need the data which i read only after sending the command. So i was wondering if there is any way to clear the tcpclient socket before we do a read. The manual doesnt show any such method.

View 1 Replies

Communications :: TcpClient/Listener ?

Jan 16, 2010

I'm having a hard time getting the fundamentals down about these TCP Socket classes.

When you use TcpClient, you can set the IP Address or domain name to connect to the server end of the socket. I see examples that use "localhost" as the first parameter for TcpClient. Is this just a broadcast over the network to find the server that has a TcpListener listening on the dictated port of the second parameter of the TcpClient declaration? With any IP address for TcpClient (I realize that's an option, though), how does "localhost" find the TcpListener server?

View 8 Replies

Create An Array Of Tcpclient 1 To 5?

Jun 7, 2012

I want to create an array of tcpclient 1 to 5. i know it can be done by arralist but how i will add array of socket in arraylist and send/receive data.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved