Building an Asyc Socket DLL using C#, I followed MS .NET FRAMEWORK
library sample (see "Asynchronous Client Socket Example") and created
a DLL called MSSock. I then reference MSSock in a .exe c# program to
test it.
This .exe has a form which has a button and a text field to invoke the
DLL async communication and display return data.
<F5>, runs ok and data returned is being displayed. Without exiting
the app, click on the button again, this supposed do exactly connect,
send, receive, close and displaying data. But, the following comes up
in a dialog box,
----------------------------------------------------------------------------
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in netsock.dll
Additional information: A request to send or receive data was
disallowed because the socket is not connected and (when sending on a
datagram socket using a sendto call) no address was supplied
----------------------------------------------------------------------------
Ok, I set a breakpoint at the line the DLL is called, stepping through
all of the lines, it ran perfectly fine, no error, returns data as
expected.
It's repeated many times with machine rebooting. I opened up a DOS
window, use
netstat -p TCP
to check socket connection statistics, whenever I got the above error,
netstat showed the State as ESTABLISHED. 1 6134
Most likely your overwriting the IPAddress in an overlapped previous
callback before the current SentTo can send or something like that. Would
probably need to post the code or a small but complete sample of the code
that shows the problem.
--
William Stacey, MVP
"Chan" <hi*****@yahoo.com> wrote in message
news:fe**************************@posting.google.c om... Building an Asyc Socket DLL using C#, I followed MS .NET FRAMEWORK library sample (see "Asynchronous Client Socket Example") and created a DLL called MSSock. I then reference MSSock in a .exe c# program to test it.
This .exe has a form which has a button and a text field to invoke the DLL async communication and display return data.
<F5>, runs ok and data returned is being displayed. Without exiting the app, click on the button again, this supposed do exactly connect, send, receive, close and displaying data. But, the following comes up in a dialog box,
--------------------------------------------------------------------------
-- An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in netsock.dll
Additional information: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied --------------------------------------------------------------------------
-- Ok, I set a breakpoint at the line the DLL is called, stepping through all of the lines, it ran perfectly fine, no error, returns data as expected.
It's repeated many times with machine rebooting. I opened up a DOS window, use
netstat -p TCP
to check socket connection statistics, whenever I got the above error, netstat showed the State as ESTABLISHED. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Niels Johansen |
last post by:
Hello,
When using the asynchronous read method in the BufferedStream class, , it seems to me that it blocks like
the normal synchronous read method. Why is it so? Why does the...
|
by: Richard |
last post by:
Hi,
I'm suffering a socket race condition - I think. The code works fine at
full speed on a single CPU machine. However when I run full speed on a 2
Zeon machine the socket drops data on an...
|
by: Colin |
last post by:
I'm writing a little console socket server but I'm having some
difficulty. Can I ask your advice - where is the best place to get
some help on that topic? It would be nice if some people who knew...
|
by: taskswap |
last post by:
I have a legacy application written in C that I'm trying to convert to
C#. It processes a very large amount of data from many clients
(actually, upstream servers - this is a mux) simultaneously.
...
|
by: Macca |
last post by:
My app has an asynchronous socket server. It will have 20 clients connected
to the server. Each client sends data every 500 millisecondsThe Connections
once established will not be closed unless...
|
by: Macca |
last post by:
Hi,
I am writing an asychronous socket server to handle 20+ simulataneous
connections.
I have used the example in MSDN as a base. The code is shown at end of
question.
Each connection has a...
|
by: Pat B |
last post by:
Hi, I'm writing my own implementation of the Gnutella P2P protocol
using C#. I have implemented it using BeginReceive and EndReceive
calls so as not to block when waiting for data from the...
|
by: Nicolas Le Gland |
last post by:
Hello everyone here.
This is my first post in this newsgroup, I hope I won't be to much
off-topic. Feel free to redirect me to any better group.
I am getting strange timing issues when...
|
by: keksy |
last post by:
Hi every1,
I am writing a small client/server application and in it I want to
send an image asynchronous from the client to the server through a TCP
socket. I found an example code on the MSDN...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |