Sponsored Content
Top Forums Programming Write the source code for messenger Post 302094486 by !_30 on Saturday 28th of October 2006 11:27:05 AM
Old 10-28-2006
Thank's guy's for answering . I found your word's useful. I'm getting over the project , everithing seem's more clearly now.
I have a few things to acommodate and everithing seem's to work just fine.

I only have a question for you.I found myself in a situation , I cannot resolve . Maybe I haven't think for the right choice yet , but you can help me ..

I written the server and client code , for some sort of messenger ( mini-version ) , and I don't know ( I may know , but not having the right idea ) , how to implement something. Smilie

I want to make an easy thing.In the source code for the client , I want to implement someting like this :

-when the client want's to transmit data , it gets the buffer ( getstr(buffer) )
-when something arive at the client , some data , it 's print's the string's arived on main window.

I cannot implement this.How can I implement this in C ? I write some sort of code , down :

Code:
int nbytes;
for (;;)
{
if (nbytes=recv(listener,buf,sizeof(buf),0) >0 )
{
        printw("%s\n",buf);
        refresh();
}
else{

getstr(s);
send(listener,s,sterlen(s),0);}

}

The problem , is that this code , is how you see , non-useful and childish.
I want something simple , when I write data , on the client ( getstr(s) ) , to be sent ( to listener -> server ) and when I receive some data ( string's ) , to be printed on the main window.This is all.
The problem is that I cannot make this ..it block's .If I don't enter a string to be sent to the ( listener -> socket server ) , it won't print ( received data ).

Should I use files ?.. or something like that ..

A help , may be needed , if you guy's get the idea , what I want Smilie
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where can I review the source code?

A very n00b question: After compiling and installing software, where does the original source code reside? I'd like to study the source code of some of the ports I've installed. Thanks! :D (1 Reply)
Discussion started by: Aaron Van
1 Replies

2. Shell Programming and Scripting

write page source to standard output

I'm new to PERL, but I want to take the page source and write it to a file or standard output. I used perl.org as a test website. Here is the script: use strict; use warnings; use LWP::Simple; getprint('http://www.perl.org') or die 'Unable to get page'; exit 0; ... (1 Reply)
Discussion started by: wxornot
1 Replies

3. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

4. UNIX for Dummies Questions & Answers

Where can i get unix source code?

Sir please tell me where can i get source code for some unix kernal and shell also. (1 Reply)
Discussion started by: VIPUL15
1 Replies

5. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

6. Linux

Source code

I need the source code of fedora. plz plz plz help me........... (1 Reply)
Discussion started by: neh
1 Replies

7. Shell Programming and Scripting

Source code compilation

Need assistance in Source code compilation . When installing a software compiling a source code . Whatever the output that prints on the screen i want to log it into a file. How can i see output and store the output to file ./configure make make install Is there other way of seeing output... (5 Replies)
Discussion started by: ajayram_arya
5 Replies

8. UNIX for Dummies Questions & Answers

Source code

hii... i am a biginner....and i have linux source code ,downloaded from some website ,a compressed file on windows and dont know how do compile them..... (4 Replies)
Discussion started by: M K Raju
4 Replies
nlsrequest(3NSL)				       Networking Services Library Functions					  nlsrequest(3NSL)

NAME
nlsrequest - format and send listener service request message SYNOPSIS
#include <listen.h> int nlsrequest(int fildes, char *service_code); extern int _nlslogt_errno; extern char *_nlsrmsg; DESCRIPTION
Given a virtual circuit to a listener process (fildes) and a service code of a server process, nlsrequest() formats and sends a service request message to the remote listener process requesting that it start the given service. nlsrequest() waits for the remote listener process to return a service request response message, which is made available to the caller in the static, null-terminated data buffer pointed to by _nlsrmsg. The service request response message includes a success or failure code and a text message. The entire message is printable. RETURN VALUES
The success or failure code is the integer return code from nlsrequest(). Zero indicates success, other negative values indicate nlsre- quest() failures as follows: -1 Error encountered by nlsrequest(), see t_errno. Positive values are error return codes from the listener process. Mnemonics for these codes are defined in <listen.h>. 2 Request message not interpretable. 3 Request service code unknown. 4 Service code known, but currently disabled. If non-null, _nlsrmsg contains a pointer to a static, null-terminated character buffer containing the service request response message. Note that both _nlsrmsg and the data buffer are overwritten by each call to nlsrequest(). If _nlslog is non-zero, nlsrequest() prints error messages on stderr. Initially, _nlslog is zero. FILES
/usr/lib/libnls.so.1 shared object ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
nlsadmin(1M), t_error(3NSL), t_snd(3NSL), t_rcv(3NSL), attributes(5) WARNINGS
nlsrequest() cannot always be certain that the remote server process has been successfully started. In this case, nlsrequest() returns with no indication of an error and the caller will receive notification of a disconnect event by way of a T_LOOK error before or during the first t_snd() or t_rcv() call. NOTES
These interfaces are unsafe in multithreaded applications. Unsafe interfaces should be called only from the main thread. SunOS 5.10 14 Nov 2002 nlsrequest(3NSL)
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy