Trouble with pipes in chat client on linux


 
Thread Tools Search this Thread
Top Forums Programming Trouble with pipes in chat client on linux
# 15  
Old 10-24-2012
BTW, pipes do not buffer/delay write() data, but FILE* do delay output until you flush or overflow the buffer, unless you turn on unbuffered or line buffered output (setvbuf()). Graceful exit() flushes all pipes on all but the most crude C compilers.

Pipes are part of IPC, along with signals, shared memory, semaphores, message queues, mmap() of files, sockets. You can inherit a fd such as a pipe or socket from a parent. You can open a named pipe and if someone opens the opposite way (r/w), you are connected 1-1. BTW, you can pass fd down a pipe so another process can attach it. I prefer mmap(): no root requirement, all RAM as a buffer, hard copy after a crash and for a restart, no swap used. Some UNIX/LINUX flavors map socket resources into the file tree. UDP Sockets are neat, as they can broadcast and multicast. A really slick messaging app would multicast, so it scaled really well. When studying IPC, make sure your opinions do not come from way back. Systems have become quite different, and culturally, apps less root entangled.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Linux chat with other users

Besides talk and write are there any other good programs for talking to a particular user on the same Linux system. (1 Reply)
Discussion started by: cokedude
1 Replies

2. Programming

logic understanding for inter client chat server

hello everyone, i am making chat server in linux using c. i have made programs in which group chat can take place between multiple clients but i am not able to understand how to make 2 particular clients chat with each other. please help!!! (1 Reply)
Discussion started by: sweetbella
1 Replies

3. Programming

please help a problem in client-server ipc message 2 pipes communication simple example

I want to have a message send & receive through 2 half-duplex pipes Flow of data top half pipe stdin--->parent(client) fd1--->pipe1-->child(server) fd1 bottom half pipe child(server) fd2---->pipe2--->parent(client) fd2--->stdout I need to have boundary structed message... (1 Reply)
Discussion started by: ouou
1 Replies

4. Homework & Coursework Questions

Help with server client chat system

request create a chat system in linux where a user type smth and all the other users connected to server get the message.then a user have to create join leave or delete a channel of chat if he created it.i did the server and the client but i dont know how to implemt the chat rooms.i was ... (1 Reply)
Discussion started by: demonmind
1 Replies

5. UNIX for Dummies Questions & Answers

Server-client chat with a bit more

The task is to create a server client chat that contains a few basic safeguards against floods etc and which is capable of issuing at least one or two commands on the client computer. Working samples of such arrangements abound but freeware/shareware samples are not readily available. A catch in... (3 Replies)
Discussion started by: Bobby
3 Replies

6. Programming

How can i make two client to chat with each other?

How can i make two client to chat with each other.. without any work of server, i mean peer to peer i am making chat messenger on which all host will connect to/via server and if any host want private chat then thay work independently... this is code(attached) which i have made for server... (1 Reply)
Discussion started by: bt87
1 Replies

7. UNIX for Dummies Questions & Answers

Server/client chat

I want to make the following programm. Using the server/client model I want 2 client to connect to the server then the server sends back to the clients the ip address and a number of a poort in order to open a udp connection between clients without using the server? What I have done since now is... (2 Replies)
Discussion started by: kasma
2 Replies

8. Programming

client /server pipes

here is the concept: the client reads a pathname from the standard input and writes it to pipe1.The server reads this pathname from the pipe1 and tries to open the file for reading.If the server can open the file ,the server responds by reading the file and writting it to pipe2;otherwise the... (2 Replies)
Discussion started by: tolkki
2 Replies

9. Programming

Chat client-server program

Good day everyone, I'm doing a chat client-server program:server is to receive messages from clients through a TCP port and multicast them back to all clients through a UDP port. This is my client program. I'd not know why it just sends and receives msg from server once, then it stops. Is... (1 Reply)
Discussion started by: powermind
1 Replies

10. Programming

multiuser chat server closes when one client closes. code included

I have been trying to write a very basic chat program but at the moment I am having problems getting it to be multiuser as it closes all connections when one client shutsdown. I have also been having problems trying to get the program to display a list of usernames to the clients. I have tried... (0 Replies)
Discussion started by: dooker
0 Replies
Login or Register to Ask a Question
TETRINET-CLIENT(6)						   Games Manual 						TETRINET-CLIENT(6)

NAME
tetrinet-client - textmode client program for tetrinet SYNOPSIS
tetrinet [-fancy] [-fast] [-log file] [-noshadow] [-noslide] [-slide] [-shadow] [-windows] nickname server DESCRIPTION
tetrinet-client is a textmode client program for tetrinet, a networked version of tetris. You can play both on TetriFast server and on the original servers with it. Please notice that you need at least 50 lines to be able to play it. OPTIONS
A summary of options is included below. -fancy Use "fancy" TTY graphics. (Note that this will slow down redraws somewhat.) -fast Use the "tetrifast" mode to connect to the server. This mode eliminates the delay before a new cube appears, thus speeding the game up noticeably. This mode is incompatible with the classic mode and the server has to support it. If in doubt, ask the other play- ers. -log file Log network traffic to the given file. All lines start with an absolute time (seconds) in brackets. Lines sent from the client to the server are prefixed with ">>>", and lines from the server to the client are prefixed with "<<<". This could be used with a utility program to replay a game later on (though such a program is not currently included in the Tetrinet distribution.) -noshadow Do not make pieces cast "shadows" when they are slowly falling. (Normally the area under piece is filled by dim dots to help to determine where the piece would hit the ground if one would press the spacebar.) -noslide Do not allow pieces to "slide" after being dropped with the spacebar. (Normally, there is a short time after pressing the spacebar during which a piece can "slide" left or right before it solidifies.) -shadow Opposite of -noshadow; make the pieces cast "shadows". Can speed up gameplay considerably, but it can be considered as cheating by some people since some other tetrinet clients lack this. -slide Opposite of -noslide; allows pieces to "slide" after being dropped. If both -slide and -noslide are given, -slide takes precedence. If both -windows and -slide are given, this overrides the "no sliding" part of -windows without affecting the other changes in pro- gram behavior. -windows Behave as much like the Windows version of Tetrinet as possible. Implies -noslide and -noshadow. USAGE
When you start tetrinet-client you will find yourself in the partyline. In here you can chat with the other players. With /help you will get the list of the server supported commands. You can switch between three screens with F1 through to F3. With /start you can start a game (if you are in position one). You will have to switch over to the Fields with the F1 key, an automatic switch over on game start is planed. To pause a running game you have to enter /pause in the partyline. To restart the game you enter /unpause. With the cursor keys left and right you can move the stones, with cursor up you turn the stones clockwise, with cursor down you pull the stones to the bottom, and with space you drop them. You have to fill the lines completely, because complete lines will get removed from the display. The more lines you can eliminate with a single stone the better. If the play room supports specials you will eventually see a list of letters below your playfield that you can use with the number keys from 1 to 6 for the corresponding playfield. If you want to get rid of a special, drop it with d. You can also chat in the playfield, to open the chat box press t (for talk.) That's it, more or less. AUTHOR
This manual page was written by Gerfried Fuchs <alfie@ist.org>. SEE ALSO
tetrinet-server(6). 2004-11-23 TETRINET-CLIENT(6)