Sponsored Content
Top Forums Programming [C++] [Unix] TCP non-blocking. Detect server disconnection procedure over, from client. Post 302589527 by ikeban on Thursday 12th of January 2012 04:05:52 AM
Old 01-12-2012
Hi!

Thanks for answer fpmurphy!
You have right, this is impossible to CLOSE socket and then read from this socket any confirmation about disconnection... but I found solution for my problem -> let's focus on my additional question:
"How to start disconnecting procedure, without closing socket?" -> This is possible.
I didn't share all information about case that I try to resolve, but to make my solution helpful for others, let's say that you are in situation, when server sent all information to client, and now client don't have more requests. Time to close connection, but as in my case, client have to be sure, that server really close connection (in non-blocking tcp type). What I did:
In client I call shutdown(SHUT_WR). This inform server, that client want to close connection (select on server side inform, that there is data to read on socket, but after read it server got 0 -> no more information from client -> disconnection!). So server close socket permanently. Because of this, client got 0 after select + read procedure on the same socket -> server finished disconnection! Now client close socket too, and make new connection on other socket without a problem!
Case solved!

Thanks for everyone for reading this thread, especially fpmurphy.

Ikeban
This User Gave Thanks to ikeban For This Post:
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

RedHat9:How to find what is blocking the port 1526/tcp

I'm trying to configure IDS9.40 on Ret Hat 9. The server has opened the port 1526/tcp nmap (nmap -sT -O linux) reports correctly that the port is open. However, portqry (portqry.exe -n 192.168.0.101 -e 1526 -p TCP) reports that the port is closed for connection: TCP port 1526 (turbo... (0 Replies)
Discussion started by: Juhasz Lajos
0 Replies

2. UNIX for Dummies Questions & Answers

updating "share" without disconnection current client

I have a directory that is currently being shared by several clients. I would like to add another client and be able to mount it without kicking the other clients off. I edited /etc/dfs/dfstab and added the client's hostname towards the end the line. i.e. share -F nfs -o... (3 Replies)
Discussion started by: benq70
3 Replies

3. Programming

tcp server listening, client connecting problems

hello everyone. I tried searching for something related to this, but I figured it was time to ask my own question. I am experiencing these problems using Ubuntu 7.04 I am starting up a TCP listener/server and once connected, will act as a communication/control link with a program on another... (3 Replies)
Discussion started by: pjwhite
3 Replies

4. Programming

can-not detect TCP disconnects well

Hello everyone. Thanks for reading. I am using Ubuntu 7.04 to experience this problem: I have written my own programs that communicate to eachother and I am having a hard time detecting a TCP socket disconnect when the remote side's computer has a power-failure (for example). On the computer... (6 Replies)
Discussion started by: pjwhite
6 Replies

5. Programming

Concurrent TCP client/server

I made a program and now I need to make it concurrent. Can someone pls help me do this ? The code is this: #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <string.h>... (4 Replies)
Discussion started by: Johnny22
4 Replies

6. Programming

How detect TCP/IP socket shutdown when ethernet cable is disconnected

Hi, I want to code TCP/IP client/server in linux application capable to fastly detect ethernet cable disconnection in any condition. So I have activate SO_KEEPALIVE options and set TCP_KEEPCNT, TCP_KEEPIDLE and TCP_KEEPINTVL to 1. When I disconnect ethernet cable I have the following... (5 Replies)
Discussion started by: jeje_clb
5 Replies

7. Windows & DOS: Issues & Discussions

Office server => laptop =>client server ...a lengthy and laborious ftp procedure

Hi All, I need your expertise in finding a way to solve my problem.Please excuse if this is not the right forum to ask this question and guide me to the correct forum,if possible. I am a DBA and on a daily basis i have to ftp huge dump files from my company server to my laptop and then... (3 Replies)
Discussion started by: kunwar
3 Replies

8. Red Hat

I want to know the disconnection time of my broadband tcp/ip connection.

Hello, I want to know the disconnection time of my broadband tcp/ip connection as it got disconnected while downloading data. I use Vuze bit torrent client and JDownloader . I use broadband internet connection and my os is slack 11. The problem I have been facing for last 2/3 days that my... (1 Reply)
Discussion started by: vectrum
1 Replies

9. Solaris

Too much TCP retransmitted and TCP duplicate on server Oracle Solaris 10

I have problem with oracle solaris 10 running on oracle sparc T4-2 server. Os information: 5.10 Generic_150400-03 sun4v sparc sun4v Output from tcpstat.d script TCP bytes: out outRetrans in inDup inUnorder 6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies

10. UNIX for Advanced & Expert Users

How to detect files transmission at UNIX server ?

Dear Expert Users, I know that Unix utility ( fuser ) is used to detect "transmission" of files from Source system to "current Linux Server". I have scheduled this Unix script to work every 30th minutes of the hour and whenever files transmission starts at that very moment. And, the file... (4 Replies)
Discussion started by: schandrakar1
4 Replies
dde(n)							       Tcl Built-In Commands							    dde(n)

__________________________________________________________________________________________________________________________________________________

NAME
dde - Execute a Dynamic Data Exchange command SYNOPSIS
package require dde 1.1 dde servername ?topic? dde ?-async? command service topic ?data? _________________________________________________________________ DESCRIPTION
This command allows an application to send Dynamic Data Exchange (DDE) command when running under Microsoft Windows. Dynamic Data Exchange is a mechanism where applications can exchange raw data. Each DDE transaction needs a service name and a topic. Both the service name and topic are application defined; Tcl uses the service name TclEval, while the topic name is the name of the interpreter given by dde server- name. Other applications have their own service names and topics. For instance, Microsoft Excel has the service name Excel. The only option to the dde command is: -async Requests asynchronous invocation. This is valid only for the execute subcommand. Normally, the dde execute subcommand waits until the command completes, returning appropriate error messages. When the -async option is used, the command returns immediately, and no error information is available. DDE COMMANDS
The following commands are a subset of the full Dynamic Data Exchange set of commands. dde servername ?topic? dde servername registers the interpreter as a DDE server with the service name TclEval and the topic name specified by topic. If no topic is given, dde servername returns the name of the current topic or the empty string if it is not registered as a service. dde execute service topic data dde execute takes the data and sends it to the server indicated by service with the topic indicated by topic. Typically, service is the name of an application, and topic is a file to work on. The data field is given to the remote application. Typically, the application treats the data field as a script, and the script is run in the application. The command returns an error if the script did not run. If the -async flag was used, the command returns immediately with no error. dde poke service topic item data dde poke passes the data to the server indicated by service using the topic and item specified. Typically, service is the name of an application. topic is application specific but can be a command to the server or the name of a file to work on. The item is also application specific and is often not used, but it must always be non-null. The data field is given to the remote application. dde request service topic item dde request is typically used to get the value of something; the value of a cell in Microsoft Excel or the text of a selection in Microsoft Word. service is typically the name of an application, topic is typically the name of the file, and item is application- specific. The command returns the value of item as defined in the application. dde services service topic dde services returns a list of service-topic pairs that currently exist on the machine. If service and topic are both null strings ({}), then all service-topic pairs currently available on the system are returned. If service is null and topic is not, then all services with the specified topic are returned. If service is not null and topic is, all topics for a given service are returned. If both are not null, if that service-topic pair currently exists, it is returned; otherwise, null is returned. dde eval topic cmd ?arg arg ...? dde eval evaluates a command and its arguments using the interpreter specified by topic. The DDE service must be the TclEval ser- vice. This command can be used to replace send on Windows. DDE AND TCL
A Tcl interpreter always has a service name of TclEval. Each different interpreter of all running Tcl applications must be given a unique name specified by dde servername. Each interp is available as a DDE topic only if the dde servername command was used to set the name of the topic for each interp. So a dde services TclEval {} command will return a list of service-topic pairs, where each of the currently run- ning interps will be a topic. When Tcl processes a dde execute command, the data for the execute is run as a script in the interp named by the topic of the dde execute command. When Tcl processes a dde request command, it returns the value of the variable given in the dde command in the context of the interp named by the dde topic. Tcl reserves the variable $TCLEVAL$EXECUTE$RESULT for internal use, and dde request commands for that variable will give unpredictable results. An external application which wishes to run a script in Tcl should have that script store its result in a variable, run the dde execute command, and the run dde request to get the value of the variable. When using DDE, be careful to ensure that the event queue is flushed using either update or vwait. This happens by default when using wish unless a blocking command is called (such as exec without adding the & to place the process in the background). If for any reason the event queue is not flushed, DDE commands may hang until the event queue is flushed. This can create a deadlock situation. SEE ALSO
tk(n), winfo(n), send(n) KEYWORDS
application, dde, name, remote execution Tcl 8.1 dde(n)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy