send function in socket


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send function in socket
# 1  
Old 11-23-2006
send function in socket

Hi All,
I encountered a stange problem while doing a perl script to use socket. i need to transfer a file from client to sever. but error came as argument missing in send function.........Plz tell me the wt r the arguments in send and recv functions.......
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Sample C program to Send/Recieve a file using Socket

Hi All, I urgently need a Sample C program to Send/Recieve a file using Socket. Thanks Sara (1 Reply)
Discussion started by: saraperu
1 Replies

2. Programming

how can I send and receive data in client server socket programing

char name; printf ("Welcome to the server \n"); printf ("Enter user name: \n"); scanf ("%c", &name); how can client send name to server:what should be the code? int send ( int sid , const char ∗buffer Ptr , int len , int f l a g ) how can client receive ack from... (1 Reply)
Discussion started by: saiful_911
1 Replies

3. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

4. Programming

Store file into a buffer to send it through a socket

Hello, I'm doing a very simple program which reads a file and sends whatever is in the file through a socket. Like the program "file2cable". Let's say i have a file containing the following, which is a hex dump of an ARP request frame: ff ff ff ff ff ff 00 1b 24 79 5a 73 08 06 00 01 08... (5 Replies)
Discussion started by: semash!
5 Replies

5. Programming

Socket Programming Send File

Hello my friends; Look at this 2 program: Client: #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> int main ( int agrc, char *argv ) { int Socket; struct sockaddr_in... (5 Replies)
Discussion started by: htabesh
5 Replies

6. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

7. Shell Programming and Scripting

Send output of .SH to a function

Hello All, I am new to Shell script world. Please help me out with following query.. OS: AIX Shell Script I am trying to execute: showStatus () { echo $1 //Actually I need to do something with the input here... } ./serverStatus.sh | grep STARTED | awk '{print $5}' | showStatus... (3 Replies)
Discussion started by: raj_uk
3 Replies

8. Programming

connect() function in C++ socket programming

Hello All, I have a problem using connect(...) function in C++. I am using SSH from my windows system to connect it to linux server. The program works fine if I run it directly in Linux machine but I need it to run through windows machine. The function returns -1 and so my program terminates. ... (3 Replies)
Discussion started by: smdhd3
3 Replies

9. Programming

Anyone know how to use socket select() function?

hello socket programming expert, I having difficulties in understanding how select() function in socket programming work.... I'm trying to create my own peer-to-peer chat or file transfer program by using the select() function.... Therefore does anyone had any tutorial or source code that... (4 Replies)
Discussion started by: draggy
4 Replies

10. Programming

UDP socket - can both client and server recv and send

Hi, Am very new to socket programming. When we use UDP sockets to communicate between two processess, will both the client/server socket be able to send/recv ? meaning can sendto()/ recvfrom() be used on both server and client? It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies
Login or Register to Ask a Question
send(2) 							System Calls Manual							   send(2)

Name
       send, sendto, sendmsg - send a message from a socket

Syntax
       #include <sys/types.h>
       #include <sys/socket.h>

       cc = send(s, msg, len, flags)
       int cc, s;
       char *msg;
       int len, flags;

       cc = sendto(s, msg, len, flags, to, tolen)
       int cc, s;
       char *msg;
       int len, flags;
       struct sockaddr *to;
       int tolen;

       cc = sendmsg(s, msg, flags)
       int cc, s;
       struct msghdr msg[];
       int flags;

Description
       The  and system calls are used to transmit a message to another socket.	The system call may be used only when the socket is in a connected
       state, while the and system calls may be used at any time.

       The address of the target is given by to, with tolen specifying its size.  The length of the message is given by len.  If  the  message	is
       too  long  to  pass atomically through the underlying protocol, the error EMSGSIZE is returned, and the message is not transmitted.  If the
       address specified in the argument is a broadcast address, the SO_BROADCAST option must be set for broadcasting to succeed.

       No indication of failure to deliver is implicit in a Return values of -1 indicate some locally detected errors.

       If no messages space is available at the socket to hold the message to be transmitted, normally blocks, unless the socket has  been  placed
       in nonblocking I/O mode.  The call can be used to determine when it is possible to send more data.

       The flags parameter can be set to MSG_OOB to send out-of-band data on sockets that support this features (for example, SOCK_STREAM).

       See for a description of the msghdr structure.

       The call returns the number of characters sent, or -1 if an error occurred.

Diagnostics
       [EBADF]		   An invalid descriptor was specified.

       [EDESTADDRREQ]	   A required address was omitted from an operation on a socket.

       [EFAULT] 	   An invalid user space address was specified for a parameter.

       [EINVAL] 	   An invalid argument length for the message was specified.

       [EINTR]		   The send was interrupted by delivery of a signal.

       [ENOTCONN]	   The socket is not connected.

       [ENOTSOCK]	   The argument s is not a socket.

       [EMSGSIZE]	   The socket requires that messages be sent atomically, and the size of the message to be sent made this impossible.

       [EPIPE]		   A write on a pipe or socket for which there is no process to read the data.

       [EWOULDBLOCK]	   The socket is marked nonblocking, and the requested operation would block.

See Also
       recv(2), getsockopt(2), socket(2)

																	   send(2)