473,406 Members | 2,281 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,406 software developers and data experts.

Winsock active-x requires object reference?

Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference to
an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

Nov 15 '05 #1
8 4300
Richy,

Why are you using an ActiveX control when you could be using the built in
functionailty of the .NET Framework classes? Look into the classes Socket,
TcpClient & TcpListener in the help. They will be able to do what you want
to do without any interop nastiness and the overhead of ActiveX.

HTH
Kieran

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:28****************************@phx.gbl...
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference to
an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

Nov 15 '05 #2
found someone with the same problem.

http://www.experts-
exchange.com/Programming/Programming_Languages/C_Sharp/Q_20
697280.html

problem is, what is the solution.

-----Original Message-----
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference toan object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

.

Nov 15 '05 #3
I have tried that, but it blocks when it is receiving data.

The Active-X provides a Data Arrival Event, preventing my
application from hanging.

What is the point of having Active-X if you cannot use
them?
-----Original Message-----
Richy,

Why are you using an ActiveX control when you could be using the built infunctionailty of the .NET Framework classes? Look into the classes Socket,TcpClient & TcpListener in the help. They will be able to do what you wantto do without any interop nastiness and the overhead of ActiveX.
HTH
Kieran

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:28****************************@phx.gbl...
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference to an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData into an array of bytes?

Richy.

.

Nov 15 '05 #4

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:28****************************@phx.gbl...
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

While I agree with Kieran, you should be using the framework classes, there
is absolutly no need to interop with the winsock activex control, but here
is my suggestion anyawy (also, is type really supposed to be the object
type? doesn't sound right to me):
object o = (object)buffer;
axWinsock1.GetData(ref o,buffer.GetType(),10);

I don't know if it will work, don't have time to try, but thats often what
you have to do in other interop situations.
The compiler complains that it is expecting a reference to
an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

Nov 15 '05 #5

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:1e****************************@phx.gbl...
I have tried that, but it blocks when it is receiving data.

The Active-X provides a Data Arrival Event, preventing my
application from hanging.

What is the point of having Active-X if you cannot use
them?


One word, LEGACY. Its not there for any other reason, imho. They are messy
to use when managed equivilents exist.

As for blocking IO, thats why various BeginXXX methods exist, they are
asynchronous and you can provide callbacks that are called when the
asynchronous method finishes.

For TcpClient, for example, returns a NetworkStream, NetworkStream has a
BeginRead method that is asynchronous, most of the other classes should have
it as well, read up on it.
-----Original Message-----
Richy,

Why are you using an ActiveX control when you could be

using the built in
functionailty of the .NET Framework classes? Look into

the classes Socket,
TcpClient & TcpListener in the help. They will be able to

do what you want
to do without any interop nastiness and the overhead of

ActiveX.

HTH
Kieran

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:28****************************@phx.gbl...
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference to an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData into an array of bytes?

Richy.

.

Nov 15 '05 #6

thanks Kieran & Daniel for the input - guess it's time to
move onto the framework classes ;-)
-----Original Message-----
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference toan object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

.

Nov 15 '05 #7

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:2a****************************@phx.gbl...

thanks Kieran & Daniel for the input - guess it's time to
move onto the framework classes ;-)


np, hope I didn't sound to harsh, I'm really rather tired, -_-
-----Original Message-----
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference

to
an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

.

Nov 15 '05 #8
Richy,
Sounds like a plan to me :) They really are much cleaner to use and probably
more efficient.

Hope you've got it working now anyway.

Kieran

"Richy" <ri*************@yahoo.co.uk> wrote in message
news:2a****************************@phx.gbl...

thanks Kieran & Daniel for the input - guess it's time to
move onto the framework classes ;-)
-----Original Message-----
Hi,

I'm using a winsock active-x component in a C# program.

I can send data using the following:

byte[] buffer = new byte[10];
axWinsock1.SendData( buffer);

But to receive isn't as easy.

The prototype is show below:

axWinsock1.GetData( ref object data, object type, object
MaxLen)

I cannot pass buffer in as a parameter, see below.

axWinsock1.GetData( ref buffer, buffer.GetType(), 10 );

The compiler complains that it is expecting a reference

to
an object as the first parameter. But it doesn't
complain about the send equivalent which is also of type
object, see below:

axWinsock1.SendData( object data )

Any one know how I would receive using axWinsock1.GetData
into an array of bytes?

Richy.

.

Nov 15 '05 #9

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

Similar topics

1
by: Niels Borg | last post by:
Hi, I'm writing app where I use WinSock, but I have experienced a problem. WinSock only sends the data after finishing the calling sub/function. Can I force WinSock immediately as I need to send...
1
by: Chris Thompson | last post by:
I'm trying to mess around with creating a multi-user server but I'm really clueless as to how to start. I don't know what I'd need to do, and more than likely it's over my head, but I'd still like...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
1
by: Yu Chai | last post by:
Hi guys, I created a ASP page that 1. users can run when WinSock proxy are using (ie's one is unchecked) 2. users can't run when WinSock proxy are using (ie's one is checked) 3. users can't run...
7
by: Nadav | last post by:
Hi I am writing some kind of a storage system that have to deal with large amounts of data passing over the net, Now, I Wonder... traditional programming would use win32 Winsock DLL as the means...
2
by: Nadav | last post by:
Hi, I am about to write a performance critical application and I wonder what is the best way to implement it... Should I use the standart Win32 winsock DLL or should I rather use the new managed...
5
by: kc | last post by:
Hi Just upgrading a app from VB6 to VB.Net. All is going well apart from the Winsock control. The first thing we notice is that there does not appear to be a .Net version (please correct me if...
1
by: Nicolas Ghesquiere | last post by:
Hello I have a problem with my current program. The meaning of the program is to allow users to login to a server to allow them to access the internet. My program communicates with a MS isa...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
3
AaronL
by: AaronL | last post by:
Hello, I am currently working on a project that has me in sort of a bind. What I want to do is retrieve web pages from the internet, and strip them down to just text. I'll get using Regular...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.