Sponsored Content
Top Forums Programming tcp server using pthreads is not working...ne help plz? Post 302250665 by PJani on Friday 24th of October 2008 02:46:49 AM
Old 10-24-2008
i think for each thread you have to make different pthread_t child like array to store that child threads in to it...
 

10 More Discussions You Might Find Interesting

1. Programming

Tcp Ip Server

i am programming a tcp_ip server which intends to listen permanently to a client . the client can disconnect and connect again and the server accept it(by this point it works).The problem is when the client lose connection without a disconnect command and my code can't get it and keeps waiting for... (4 Replies)
Discussion started by: massimo_ratti
4 Replies

2. Programming

multi-threaded server, pthreads, sleep

I am trying to writa a multi-client & multi-threaded TCP server. There is a thread pool. Each thread in the pool will handle requests of multiple clients. But here I have a problem. I find a solution but it is not how it must be... i think. When threads working without sleep(1) I can't... (0 Replies)
Discussion started by: Parahat Melayev
0 Replies

3. UNIX for Dummies Questions & Answers

Tcp-server

I have true64 Unix running and there a scales in the sytem which connect thru a com-server to the network. they have their own IP-address and are communicating over port 8000. when I telnet to the com-servers and the print function of the scale is executed I can see the data coming. I need to know... (1 Reply)
Discussion started by: albinhess
1 Replies

4. Programming

How to check TCP server status

Please tell me according to C/C++ socket programming; how client can check whether server is running or not during TCP communication. (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

5. Shell Programming and Scripting

How can i hide Server Type Plz

Helo .. How Can i Hide My Server Type Here Hostpres.com - Host Pres And writing Secureb By .... And how Can i Hide uname -a: Linux server.xxxx.net 2.6.18-ovz028stab053.14-enterprise #1 SMP Mon Jun 2 18:25:30 MSD 2008 i686 From Php Shell Like c99... (3 Replies)
Discussion started by: a7medo
3 Replies

6. IP Networking

TCP server dies after few hours of inactivity

We have a NAS application which can be accessed by both HTTP and HTTPS connections. The issue we are facing is that the tcp server instance that initiates the HTTP access dies after a few hours of inactivity(the NAS application was kept idle for around 10 hours). However, the tcpserver that... (1 Reply)
Discussion started by: swatidas11
1 Replies

7. Programming

Problem with tcp server

Hello @ all, I hope you can give me some advice :b: I will be following code for a tcp server and doStuff () function, the clients treated. From some point, I have several identical clients (zombies, I think), the same records in the database write. Has anyone an explanation? What can I... (1 Reply)
Discussion started by: yumos
1 Replies

8. Programming

Concurrent TCP client/server

I made a program and now I need to make it concurrent. Can someone pls help me do this ? The code is this: #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <string.h>... (4 Replies)
Discussion started by: Johnny22
4 Replies

9. Solaris

TCP listner on Solaris server

Hi, I am having a solaris server. I want to start a dummy TCP listner on UNIX OS on a specific port can anyone please let me know the process. IP ADDRESS: 123.123.123.123 Port: 8010 (1 Reply)
Discussion started by: mayank2211
1 Replies

10. Solaris

Too much TCP retransmitted and TCP duplicate on server Oracle Solaris 10

I have problem with oracle solaris 10 running on oracle sparc T4-2 server. Os information: 5.10 Generic_150400-03 sun4v sparc sun4v Output from tcpstat.d script TCP bytes: out outRetrans in inDup inUnorder 6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies
pthread_atfork(3)					     Library Functions Manual						 pthread_atfork(3)

NAME
pthread_atfork - Declares fork handler routines to be called when the calling thread's process forks a child process. LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <pthread.h> int pthread_atfork( void (*prepare)(void), void (*parent)(void), void (*child)(void)); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
Address of a routine that performs the fork preparation handling. This routine is called in the parent process before creating the child process. Address of a routine that performs the fork parent handling. This routine is called in the parent process after creating the child process and before returning to the caller of fork(2). Address of a routine that performs the fork child handling. This routine is called in the child process before returning to the caller of fork(2). DESCRIPTION
This routine allows a main program or library to control resources during a fork(2) operation by declaring fork handler routines, as fol- lows: The fork handler routine specified in the prepare argument is called before fork(2) executes. The fork handler routine specified in the parent argument is called after fork(2) executes within the parent process. The fork handler routine specified in the child argument is called in the new child process after fork(2) executes. Your program (or library) can use fork handlers to ensure that program context in the child process is consistent and meaningful. After fork(2) executes, only the calling thread exists in the child process, and the state of all memory in the parent process is replicated in the child process, including the states of any mutexes, condition variables, and so on. For example, in the new child process there might exist locked mutexes that are copies of mutexes that were locked in the parent process by threads that do not exist in the child process. Therefore, any associated program state might be inconsistent in the child process. The program can avoid this problem by calling pthread_atfork to provide routines that acquire and release resources that are critical to the child process. For example, the prepare handler should lock all mutexes that you want to be usable in the child process. The parent handler just unlocks those mutexes. The child handler will also unlock them all--and might also create threads or reset any program state for the child process. If no fork handling is desired, you can set any of this routine's arguments to NULL. NOTES
It is not legal to call pthread_atfork from within a fork handler routine. Doing so could cause a deadlock. EXAMPLES
For example, if your library uses a mutex my_mutex, you might provide pthread_atfork handler routines coded as follows: void my_prepare(void) { pthread_mutex_lock(&my_mutex); } void my_parent(void) { pthread_mutex_unlock(&my_mutex); } void my_child(void) { pthread_mutex_unlock(&my_mutex); /* Reinitialize state that doesn't apply...like heap owned */ /* by other threads */ } { . . . pthread_atfork(my_prepare, my_parent, my_child); . . fork(); } RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion Insufficient table space exists to record the fork handler routines' addresses. ERRORS
None RELATED INFORMATION
Functions: pthread_create(3) Manuals: Guide to DECthreads, Programmer's Guide delim off pthread_atfork(3)
All times are GMT -4. The time now is 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy