473,373 Members | 1,048 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,373 software developers and data experts.

Expert Input for Asynchronous Socket

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.
Nov 16 '05 #1
1 6130
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.


Nov 16 '05 #2

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

Similar topics

1
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...
0
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...
7
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...
4
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. ...
2
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...
0
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...
6
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...
2
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...
1
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.