Sponsored Content
Full Discussion: recv() not workin fine.....
Special Forums IP Networking recv() not workin fine..... Post 87202 by mridula on Friday 21st of October 2005 05:29:39 AM
Old 10-21-2005
recv() not workin fine.....

hi !

In my program I have a structure as shown below:
struct data
{
int a;
char *b;
long c;
}str;

i have assigned the following values to it:
strcpy(str.b,"John");
str.a=10;
str.c=123435;

The client is tryin to send struct data to the server using
send(sock,(char * )&str,sizeof(str),flag);

At the server side the data is read using the following:

recv(sock,(char *)&str,sizeof(str),flag);

but when i print the values on to the screen only the values of a and c get printed and b does not get printed.

The server also contains the structure.

i cant figure out y this is happening. any help is appreciated.

thanx
 

10 More Discussions You Might Find Interesting

1. Programming

recv() problems using AIX 4.33

I am opening a server socket on one of our machines and connection to it on the other machine. After making the connection if ether one of the systems does a recv() and ther is no data to receive then the buffer is filled with spaces and returns. I have no way of knowing if it is valid or not. ... (1 Reply)
Discussion started by: hazard0007
1 Replies

2. Programming

C Network Programming - recv() help

So I'm making a program that gets the IP Address of an inputed website, then sends the IP Address to an inputed host. This program has no real meaning, but just a learning experiment. So I sucessfully made the program, then I wanted to try out recv(), and it produces some weird output; here is the... (2 Replies)
Discussion started by: Octal
2 Replies

3. Shell Programming and Scripting

rsh within awk is not workin

cat input.sh | awk ' { cur1=tolower($1) cur2=tolower($2) rsh $cur1 report | grep $cur2 } ' hi, Have a look at the above code, the input.txt file contains two words in each line with space as delimiter, the first word is computer name and the 2nd word is file... (2 Replies)
Discussion started by: geeko
2 Replies

4. Shell Programming and Scripting

why is it workin for 1 file , but not for multiple files?

Hi , this peice of code is working for one file but not for multiple files. Can some one please tell me the reason??? for i in `ls -1 | egrep ''SOM.*` ; do filename=$(ls -1 $i) filename=$(print $filename) if ] then print "Skipping file $i since it already has... (1 Reply)
Discussion started by: somanath Patrud
1 Replies

5. Shell Programming and Scripting

determine the periodfor which user is workin

write a shell script that determines the period for which a specified user is workin on the system. (3 Replies)
Discussion started by: shawz
3 Replies

6. Programming

ABOUT RECV() SYSTEM CALL (regarding timer)

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any... (0 Replies)
Discussion started by: Rohil
0 Replies

7. Programming

Recv() call with timer(time out )

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any one knows... (2 Replies)
Discussion started by: Rohil
2 Replies

8. IP Networking

regarding recv function

hi, the syntax of recv function is: int recv( int sockfd, void *buffer, int length, unsigned int flags); Suppose i declared a buffer of size 100 ,then length to be specified in recv function is sizeof(buffer) or sizeof(buffer)-1 ( i.e 100 or 99) thanks in advance (2 Replies)
Discussion started by: kavitha rao
2 Replies

9. Programming

How can I tell when recv is finished with pending data?

I'm working with recv and I am having a heck of a lot of trouble ignoring excess data that I did not ask for. I was hoping someone could shine some light on the subject for me because I'm not getting anywhere fast. ---------- Post updated at 02:46 AM ---------- Previous update was at 12:31 AM... (2 Replies)
Discussion started by: Errigour
2 Replies

10. Shell Programming and Scripting

Bash regex evaluation not workin

I'm building a script that may received start and end date as parameters. I whant to make it as flexible as possible so I'm accepting epoch and date in a way that "date --date=" command may accept. In order to know if parameter provided is an epoc or a "date --date=" string I evaluate if the value... (2 Replies)
Discussion started by: lramirev
2 Replies
curs_instr(3X)															    curs_instr(3X)

NAME
instr, innstr, winstr, winnstr, mvinstr, mvinnstr, mvwinstr, mvwinnstr - get a string of characters from a curses window SYNOPSIS
#include <curses.h> int instr(char *str); int innstr(char *str, int n); int winstr(WINDOW *win, char *str); int winnstr(WINDOW *win, char *str, int n); int mvinstr(int y, int x, char *str); int mvinnstr(int y, int x, char *str, int n); int mvwinstr(WINDOW *win, int y, int x, char *str); int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); DESCRIPTION
These routines return a string of characters in str, extracted starting at the current cursor position in the named window. Attributes are stripped from the characters. The four functions with n as the last argument return a leading substring at most n characters long (exclu- sive of the trailing NUL). RETURN VALUE
All of the functions return ERR upon failure, or the number of characters actually read into the string. X/Open defines no error conditions. In this implementation, if the window parameter is null or the str parameter is null, a zero is returned. NOTES
Note that all routines except winnstr may be macros. PORTABILITY
SVr4 does not document whether a length limit includes or excludes the trailing NUL. The ncurses library extends the XSI description by allowing a negative value for n. In this case, the functions return the string ending at the right margin. SEE ALSO
curses(3X). curs_instr(3X)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy