Closing a Socket!

Hello
I want to close the socket that i have opened but i t gives me an assertion failure.

I have a dialog application.In my OnInitDilaog i have the following statement
m_pThread=AfxBeginThread(OnListen,(LPVOID )this);
The OnListen contains code for creation of the socket and other routines.
I have a menu item "reset" upon clicking that i close the socket as
goSocket_Send->Close();
goSocket_Recv->Close();

I get an assertion in the above statements.

Could anyone please explain this strange situation

Regards
Badri

If u got helped Rate this..

Closing socket ports on linux

K since I am a linux noob I need help from you sudo guros.I'm developing an application using sockets in PHP. Lets say for whateever reason my script opens the port and then fails to close it. Even after reboot I cannot use that port as it tells me port is still in use. So how (either via command li ...

Crash during Closing socket

HiI made an active X component using ATL COM wizard in VC++.In that i used CSOcket class to create sockets ..Everrthing is working fine except one big problem, when i closed my application it is giving a crash. When i debug the application i found that is is crashing inside CSocket::Close() in ASynS ...

Closing socket

HiI have this problem:I have a dialog, from where I start a thread.In this worker thread I create instance of a CSocket, to a global variable I store SOCKET handle m_hSocket, then I call Connect().User click to cancel (stop connecting), so in dialog I create new instance CSocket, I attach global soc ...

Closing socket on Win CE bug?

Winsock/WinCE poser for you:In my program I am using a blocking socket. I have a background thread dedicated to reading from the socket (it sits on a ::recv call until it receives something).From another thread I close the socket usingshutdown(sock,SD_BOTH);closesocket(sock);In Windows 2000, this re ...

Closing socket in client but...

I have a thread for sending data to a client(with a public CSocket object)but when my client disconnected or closed my server can not find it or can notget a Notification but when CSocket object is a public member of my CWinAppmy server can get this NotificationMy program have request->A thre ...

CSocket Problem: sending data and closing socket

I am writing the following simple program:Client opens TCP connection to server.Server sends clinet about 100K of data and closes connection.Client reads data, closes connection.I've overridden OnRecieve and OnClose CSocket methods.The problem is that I recieve OnClose before I recieve all data.This ...

Closing socket

I would be most grateful for your help. I am looking for a proper way to close a socket without blocking. Is the call to shutdown('s', SD_BOTH) ok? I am making this call when I am sure that there is no more data to be sent or received over the socket. ...

Closing socket to client and continuing script execution

I am developing some AJAX apps and I need to close the socket connection with the client so the browser will execute the server response without waiting for the script to complete it's execution.Here's what I want:<?php$bar = $_POST['foo'];echo "alert('You said '".$bar."')";// ...

Oracle <BEA-000449> <Closing socket as no data read from it

Can you please put some lights on the following thing please?After I run my app,when the page is rendered perfectly I get the following msg in my console-- <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:3,439 during the configured idle timeo ...

file descriptors are not being free even after closing the socket connectio

My application is giving the error of nofiledesc exceeding while tring to get a socket connection.When I checked with the command lsof total number of file descriptor used on that particular instance, it gave me 1956. And the current setting for total number of file descriptor is 2000 (the default o ...

trouble in closing a socket

I wanted to know how can we close or shutdown the socket. I have built a chat program using asynchronous sockets and now I want to change the port at run time. But, when I try to close the port it is already listening to I get exceptions like only "only one usage of each socket address protocol ...

Socket closing after one minute if no data?

I'm working on a multi-process C application, where there is a server and another program that connects to the server via a UNIX domain socket and sends it commands (and then shows the results.) One of these commands is to display a log a bit at a time, and it does this by sending a "read" ...

closing blocking socket

I open a socket like thisif ((sockM = socket(AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET){printf("socket failed with: %d\n", WSAGetLastError());WSACleanup();return -1;}when i receive, i do the following polling but the thing is if no messages come, the recvfrom will not exit !! how to make ...

Socket Closing Problem

I am developing a multithreaded chat Application which has two parts Server and Client .when i connect with my server through my client and disconnect then there is no error but when i repeate this process saveral times my server application respondes very slowely at that time if i take the status b ...

Closing a socket

Hi, I'm doing a client/server with threads instead of forks. The goal is to have multiple clients connect to the server and for each client the server makes a new thread. Although it's working atm, there are things that bother me, especially the sockets. The first thing I want to know is (when using ...

Error when closing a socket and reconnecting

Following problem:I created a Socket (CSocket instance), bound it and connected to host.After data exchange, I closed the Socket (x.close ()) Now, I want to reuse this Socket to establish a new connection to another host - but the programm terminates with an assert.Is the socket still in use, even i ...

problem with closing a socket

I've created a CSocket socket in a child thread. It is being blocked by a blocking operation like receive or accept.When I try to close the socket in the parent thread, the program crashes in sockcore.cppAny ideas why this is happening? Is it legal to close a socket in a thread that didn't create it ...

socket closing ==> Connection reset by peer

1- I have a server and a client. 2- the client exchange data with the server after connection. 3- the client closes the connection (closesocket(sock))4- all must be ok but when the client closes the conn by calling closesocket(). in the server side the call to recv on that corresponding socket will ...

Why is my Listening Socket Closing?

Oki I have a listening socket that closes after connection attempt has been made.ok if in my OnAccept Function i have thisCTunel acceptor;Accept(acceptor);the socket closes immediatelybut if i make itCTunel acceptor;if(Accept(acceptor)) { AfxMessageBox("GOOD"); }i am able to receive data a ...

Closing Async Listenging Socket

Lo AllI'm playing around with Async Socket Server and Clients. I wrote a little server which has two simple buttons: Start and Stop ;)The start button works quite good:IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost");IPAddress ipAddress = ipHostInfo.AddressList[0];IPEndPoint localEnd ...

Socket Peer Closing

i had worked befor on socket programming using VC++, using an Ascync. Technique (OnReceive, OnClose, ... etc).and now trying to migrate to C#, I still did not find a corresponding method to (OnClose) so that I can know the Peer has closed connection.Like (Begin/End Accept is Correspondant to OnAccep ...

jQuery closing window in FF 2.0, IE6, IE7

I know this is not jQuery related but does anyone know how to close thosebrowers?this only works on IE's< a href=”javascript:window.open(”,’_parent’,”);window.close();”>Close thiswindow -- View this message in context: http://www.nabble.com/closing-window-in-FF-2.0%2C-IE6%2C-IE ...

jQuery Closing a thickbox from within an iframe

Is it possible to be able to close an iframe from within itself?I am using an iframe thickbox to upload an image. I would like to be ableto close the iframe/thickbox and refresh the page when the script completes.Anyone got any ideas?ThanksMarc-- View this message in context: http://www.nabble.com/C ...

jQuery Closing a tickbox from within an iframe

Is it possible to be able to close an iframe from within itself?I am using an iframe thickbox to upload an image. I would like to be ableto close the iframe/thickbox and refresh the page when the script completes.Anyone got any ideas?ThanksMarc-- View this message in context: http://www.nabble.com/C ...

jQuery Closing a tickbox from within an iframe

Marc,No suggestion here, but I'd love to see a tutorial on how you'veimplemented this if possible... when you get it working. It sounds likesomething the jquery community could use.-----Original Message-----From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] OnBehalf Of mmch ...

jQuery jqModal: Defining a custom event before closing the window?

Thanks Chris, This sounds like a winning idea. I'm still new to JQuery and its plug-ins and syntax, but if the ID of my save button is "saveButton", how would I invoke '.trigger("#cancelButton")'? Would it be ...<input type="button" id="saveButton ...

jQuery jqModal: Defining a custom event before closing the window?

Rock on! Works perfectly. ...

jQuery jqModal: Defining a custom event before closing the window?

I'm trying to create a modal dialog usinghttp://dev.iceburg.net/jquery/jqModal/where I want to have two buttons, "Save" and 'Cancel". Clicking "Save" should perform some action, and then close the window. However, if I define the "onclick" handler for the ...

jQuery jqModal and closing

hey,I am working with the jqModal and I am trying to set a button in the frameto close it. This is what I got:    $('.jqmWindow').jqm({        trigger: elem,        ajax: $(elem).attr('hre ...