473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Sockets and managing no of connections

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...
Nov 20 '05 #1
0 1007

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan | last post by:
I have a problem and I don't quite know how to implement the solution. I'll have a server application that will listen on a tcp port and make many similtaneous connections to remote clients. ...
3
by: Corne Oosthuizen | last post by:
I'm writing a Telnet Server application using Asynchronous sockets. I spawn a listener thread to handel incomming connections and create a separate client socket for each new connection. I...
4
by: 0to60 | last post by:
I have a question about socket programming in general. Exactly what happens behind the scenes when I one socket connects to a different socket in listen mode? Using the dotnet framework, I...
15
by: mrpolitics | last post by:
So I'm working with PureIRCD (http://sourceforge.net/projects/pure-ircd) and everything was fine untill yesterday when the server crashed. So I did a cold restart and staretd the server back up...
2
by: jasonsgeiger | last post by:
From: "Factor" <jasonsgeiger@gmail.com> Newsgroups: microsoft.public.in.csharp Subject: Multiple Clients, One port Date: Wed, 19 Apr 2006 09:36:02 -0700 I'm been working with sockets for a...
2
by: a_agaga | last post by:
Do you know are there some reasons why many do not make processes to communicate through memory? Why network connections (sockets) are used so commonly in IPC (inter process communication)...
4
by: billie | last post by:
Hi all. I'm (re)writing an FTP server application by using asyncore/asynchat modules. FTP tipically got two different channels: command and data. I'm succesfully managing command channel through...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.