Building an Asyc Socket DLL using C#, I followed MS .NET FRAMEWORK
library sample (see "Asynchrono us 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.Soc kets.SocketExce ption'
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 6143
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.goo gle.com... Building an Asyc Socket DLL using C#, I followed MS .NET FRAMEWORK library sample (see "Asynchrono us 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.Soc kets.SocketExce ption' 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
BufferedStream.BeginRead() not behave similar to the
NetworkStream.BeginRead() ??
The following short program illustrates my problem.:
using System;
|
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 asynchronous receive. If I slow a
connected client down by step debugging or putting Thread.Sleep() calls
between sends then the code works on the...
|
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 what
they were doing could take a look at my code and tell me where and why
I'm going wrong.
Any suggestions of groups or forums?
|
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.
I've read through what must be dozens of ways to do socket
communication in C#, and it seems they all devolve into three basic
options -...
|
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 there is a problem with the
connection.
I need to know which client has sent the incoming data as each client has
its own buffer on my "server"...
| |
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 number of different types of data coming in. I have a
databuffer for each type of data coming in.
|
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 supernode.
Everything I have written works fine sending and receiving
uncompressed data. But now I want to implement compression using the
deflate...
|
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 failing to asynchronously connect
sockets on closed or filtered ports, but I'm quite unsure if this is a PHP
issue or my misunderstanding, as it seems...
|
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 site, which is actually
for sending strings. I tried to adapt this code so that the client
sends an image instead of a string. However, there is...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |