Sponsored Content
Top Forums Programming Need help in Unix C programming Post 302411429 by Corona688 on Thursday 8th of April 2010 12:55:17 PM
Old 04-08-2010
If you're not receiving all the data, do another read() to get the rest. Like any stream, you're not guaranteed it all in one go. If you've been assuming you always get it all at once, that's probably where the garbage is coming from too -- writing data you never got, and starting halfway through other things when you start the "next" struct. If you're sending fixed size data structures back and forth you might consider packet sockets instead of stream ones; UDP packets will always arrive whole. They can't hold much more than one kilobyte per packet though.

Also, please post your actual code. If you have perrors everywhere then you clipped an awful lot of error checking to post that here; most of our suggestions would be "check z's return value" when you're already doing so. Smilie

Last edited by Corona688; 04-08-2010 at 02:03 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

programming on unix

can someone tell me some programming commands on unix? (2 Replies)
Discussion started by: fretis
2 Replies

2. Programming

c programming or unix programming!?

i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies

3. UNIX for Advanced & Expert Users

unix programming

hi guys, I m from india. I m working as programmer in one of MNC. Since 3 years im working on Microsoft platform on dot net and platforms. but now i decided to shift my future to unix , Linux side. I want to be the part of this open source family. and with this i want to make my future also.... (3 Replies)
Discussion started by: d_swapneel14
3 Replies

4. UNIX for Dummies Questions & Answers

new to unix programming

hi guys, I m from india. I m working as programmer in one of MNC. Since 3 years im working on Microsoft platform on dot net and platforms. but now i decided to shift my future to unix , Linux side. I want to be the part of this open source family. and with this i want to make my future also.... (6 Replies)
Discussion started by: d_swapneel14
6 Replies

5. Shell Programming and Scripting

Unix Systems Programming Vs Unix Programming

Several months ago I found a link that explained the difference between how a Unix Systems Admin would do scripting compared to what a Unix Programmer would do. It showed a basic script and then show several iterations that explained how the Systems Admin would change it to make it better. I was... (0 Replies)
Discussion started by: BCarlson
0 Replies

6. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

7. UNIX for Dummies Questions & Answers

C Programming in Unix

I asked this over on the "High Level Programming Section" but there must be a secret handshake or something that I am missing.....anyway....if a person wanted to start some C programming in UNIX what would be the best compiler to start with ?? I am fairly familiar with visual studio and have done... (2 Replies)
Discussion started by: zapper222
2 Replies

8. Shell Programming and Scripting

Unix programming help

hey guys im trying to create a batch file that makes directories i have this code atm #!/bin/sh echo "Please enter file name:" read Filename echo "enter number of files to be created " read created for (( i = 1; i < &created; 1++ )) do mkdir $Filename$i done assume i enter... (7 Replies)
Discussion started by: josh111
7 Replies

9. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies
sdp(7D) 							      Devices								   sdp(7D)

NAME
sdp - Sockets Direct Protocol driver SYNOPSIS
#include <socket.h> #include <netinet/in.h> s = socket(AF_INET, SOCK_STREAM, PROTO_SDP); s = socket(AF_INET6, SOCK_STREAM, PROTO_SDP); DESCRIPTION
The Sockets Direct Protocol (SDP) is a transport protocol layered over the Infiniband Transport Framework (IBTF). SDP is a standard imple- mentation based on Annex 4 of the Infiniband Architecture Specification Vol 1 and provides reliable byte-stream, flow controlled two-way data transmission that closely mimics the Transmission Control Protocol (TCP). SDP supports a sockets-based SOCK_STREAM interface to application programs. It also supports graceful close (including half-closed sock- ets), IP addressing (IPv4 or IPv6), the connecting/accepting connect model, out-of-band (OOB) data and common socket options. The SDP pro- tocol also supports kernel bypass data transfers and data transfers from send-upper-layer-protocol (ULP) buffers to receive ULP buffers. A SDP message includes a BSDH header followed by data. (A BSDH header advertises the amount of available buffers on the local side). SDP networking functionality is broken into the sdp driver and a function call-based sockfs implementation. A new protocol family of PROTO_SDP is introduced to use the SDP transport provided by the driver. Sockets utilizing SDP are either active or passive. Active sockets initiate connections to passive sockets. Both active and passive sockets must have their local IP or IPv6 address and SDP port number bound with the bind(3SOCKET) system call after the socket is created. By default, SDP sockets are active. A passive socket is created by calling the listen(3SOCKET) system call after binding the socket with bind(). This process establishes a queueing parameter for the passive socket. Connections to the passive socket can be received with the accept(3SOCKET) system call. Active sockets use the connect(3SOCKET) call after binding to initiate connections. In most cases, SDP sends data when it is presented. When outstanding data is not yet acknowledged, SDP gathers small amounts of output to be sent in a single packet once an acknowledgement is received. For a small number of clients this packetization may cause significant delays. To circumvent this problem, SDP provided by the driver supplies SDP_NODELAY, a socket-level boolean option. Note that this behav- ior is similar to the TCP_NODELAY option. SDP provides an urgent data mechanism that can be invoked using the out-of-band provisions of send(3SOCKET). The out-of-band delivery behavior is identical to TCP. The caller may mark one byte as "urgent" with the MSG_OOB flag to send(3SOCKET). This sets an "urgent pointer" pointing to the byte in the SDP stream. The receiver of the stream is notified of the urgent data by a SIGURG signal. The SIOCAT- MARK ioctl(2) request returns a value indicating whether the stream is at the urgent mark. Because the system never returns data across the urgent mark in a single read(2) call, it is possible to advance to the urgent data in a simple loop which reads data, testing the socket with the SIOCATMARK ioctl() request until it reaches the mark. ADDRESS FORMATS
SDP uses IP/IPv6 addresses to refer to local and remote devices and opens a reliable connected IB connection between two end points. The sdp driver supports a point-to-point connection, however broadcasting and multicasting are not supported. SOCKET OPTIONS
SDP supports setsockopt and getsockopt to set and read socket options. Very few socket options affect SDP protocol operations. Other common socket options are processed but do not affect SDP protocol operation. All socket options are checked for validity. A getsockopt returns the values set or toggled by setsockopt. Socket options that affect protocol operations are SO_LINGER, SO_DEBUG, SO_REUSEADDR and SO_OOBINLINE. ERRORS
EISCONN A connect() operation was attempted on a socket on which a connect() operation had already been performed. ECONNRESET The remote peer forced the connection to be closed. This usually occurs when the remote machine loses state information about the connection due to a crash. ECONNREFUSED The remote peer actively refused connection establishment. This usually occurs because no process is listening to the port. EADDRINUSE A bind() operation was attempted on a socket with a network address/port pair that has already been bound to another socket. EADDRNOTAVAIL A bind() operation was attempted on a socket with a network address for which no network interface exists. EACCES A bind() operation was attempted with a reserved port number and the effective user ID of the process was not the privileged user. ENOBUFS The system ran out of memory for internal data structures. FILES
/kernel/drv/sdp 32-bit ELF kernel module (x86). /kernel/drv/amd64/sdp 64-bit ELF kernel module (x86). /kernel/drv/sparcv9/sdp 64-bit ELF kernel module (SPARC). /kernel/drv/sdpib 32-bit ELF kernel module (x86). /kernel/drv/amd64/sdpib 64-bit ELF kernel module (x86). /kernel/drv/sparcv9/sdpib 64-bit ELF kernel module (SPARC). ATTRIBUTES
See attributes(5) for descriptions of the following attribute: +-------------------------+---------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-------------------------+---------------------------------+ |Architecture | x86, SPARC | +-------------------------+---------------------------------+ |Availability | SUNWibsdp, SUNWibsdp | +-------------------------+---------------------------------+ SEE ALSO
read(2), getsockopt(3XNET), socket.h(3HEAD), accept(3SOCKET), bind(3SOCKET), connect(3SOCKET), send(3SOCKET), attributes(5), standards(5) Infiniband Architecture Specification Vol 1- Annex 4 -- November, 2002 SunOS 5.11 13 Nov 2006 sdp(7D)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy