y objective is to retrieve data from a remote server through sockets.the Maximum no of sockets that can be opened are four.
The component that has to be developed in .net which must be COM compatible.
I would like to utilize asynchronous programming model of sockets in receiving data.
my basic idea on how to start was like this
define a connection class called connection that has a static member called socket.
so there will be only one socket for all the instances.for now we will assume that our maximum is one.
define the methods called connect,send.
and an asynchronous method for receiving the data.
so whenever the data comes, it populates a static collection (hash table). this hash table is accessible to all instances.
There is a another class called Transaction class that creates an instance of connection class and calls the methods connect,send.
how should i write events on population of hash table to signal the instance of transaction class that it can now look at the collection to get the response.
i raised an event in connection class and handling that event in transaction class using addhandler method. it does not work all the time. my logs show that the event has fired. and the event was caught.
I basically store the value from the event into a variable and give that back to browser.
my code is as follows of transaction class
Dim lobj As connection.cconnect
lobj = New connection.cconnect
AddHandler lobj.GotData, AddressOf wehavedata1
lobj.onConnect(vrequest, True)
lobj.cmdSend(vrequest)
WriteToLog("Response assigned at this time:" & Now())
fProcessTransaction = mresponsestring
for event handler .
Public Sub wehavedata1(ByVal restr As String)
WriteToLog("Event caught at time:" & Now() & "value is:" & restr)
mresponsestring = restr
can any one tell why i am not expecting response.
is there anything wrong with addhandler statement.
Raiseevent is occuring in the connection class in any call back function.
I would appreciate any help inthis regard
End Sub
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...