LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2008, 06:12 AM   #1
alanchansl
LQ Newbie
 
Registered: Jun 2006
Posts: 23

Rep: Reputation: 15
How to determine the data is sent by socket send function


Dear Sirs,

Would you mind to tel me what is function or the way to determine that the data is sent by the socket send function in C language?

Besides, please suggest where can I search for all the C language APIs reference in Linux?

Thank you very much.

Alan.
 
Old 10-16-2008, 07:56 AM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by alanchansl View Post
Would you mind to tel me what is function or the way to determine that the data is sent by the socket send function in C language?
I would recommend "man send" and look at the section titled "RETURN VALUE".

Quote:
Originally Posted by alanchansl View Post
Besides, please suggest where can I search for all the C language APIs reference in Linux?
Once again, the man pages are the easiest to use reference for these questions. You can even access the man pages on the web.
 
Old 10-16-2008, 11:58 PM   #3
alanchansl
LQ Newbie
 
Registered: Jun 2006
Posts: 23

Original Poster
Rep: Reputation: 15
Hi David,

Many thanks on your reply.

I checked the the return value of the send function. It just gave how many byte of data is successful sent. However, the data is not really sent out from the system on this API reply. It just pass the data to lower layer and waiting for send physically. For my question, I want to know whether Linux has API for me to check whether there are data waiting for send in network layer. Sorry to tell that, my application is send data through by socket connection.

For the man page on web, it is really very useful. thank you very much.
By the way, is there any others which will group the APIs by features, eg. network connection and etc.

Thank you again.

Alan.
 
Old 10-17-2008, 12:32 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I think we need to see your code. Your qn is not that clear (to me anyway).
 
Old 10-17-2008, 02:21 AM   #5
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
I was looking through /usr/include/linux/sockios.h for an ioctl that might help, but I didn't see one. Generally receipt is more important than transmission; therefore, you might consider having the receiver send a response and wait for it at the sender before moving on.
ta0kira
 
Old 10-20-2008, 01:43 AM   #6
alanchansl
LQ Newbie
 
Registered: Jun 2006
Posts: 23

Original Poster
Rep: Reputation: 15
Hi,

Thank you for all of your replies.
Let me talks about more about my application.
Actually, the Linux system is running in an embedded system and it will send data through socket connection only. The system will fall in suspend mode regularly. So when the system woke up and let the application to send data out. After the data is sent in application layer, i.e it has reply from send api already, the system fall in suspend again. Then I found there is data lost due to system slept.

So my question is how I know that the data is really sent out before the system sleep.

Thanks again to all of you.

Alan.
 
Old 10-20-2008, 01:57 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Like ta0kira said, have the receiver send a confirmation back.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send and receive data from a single socket in perl?? murahman Programming 0 07-28-2008 03:29 AM
How to send data to WAN Interface card at Data link Layer in linux environment krishna_karne Linux - Software 0 05-09-2008 04:01 AM
Bad data in socket read function nhydra Programming 2 05-08-2006 03:16 AM
cannot read data at server socket, though client socket sends it jacques83 Linux - Networking 0 11-15-2005 01:58 PM
How to determine lost socket connection sasha_baranov Linux - Newbie 2 09-24-2004 04:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration