when doing fork in a loop: -
while(1) {
-
tmp_sd = accept(sd, (struct sockaddr*)&tmp_sin, &len);
-
if (tmp_sd == -1) {
-
perror("accept");
-
exit(0);
-
}
-
-
//check client ip
-
-
//fork
-
pid = fork();
-
switch(pid) {
-
case -1:
-
perror("fork");
-
break;
-
case 0:
-
_exit(0);
-
}
-
-
close(tmp_sd);
-
}
-
If there's no fork, the code done well.
But if fork, when telnet, it has error: accept: Invalid argument
Thanks a lot. 12 7184
Yarco wrote: when doing fork in a loop: - while(1) {
- tmp_sd = accept(sd, (struct sockaddr*)&tmp_sin, &len);
- if (tmp_sd == -1) {
- perror("accept");
- exit(0);
- }
- //check client ip
- //fork
- pid = fork();
- switch(pid) {
- case -1:
- perror("fork");
- break;
- case 0:
- _exit(0);
- }
- close(tmp_sd);
- }
-
If there's no fork, the code done well. But if fork, when telnet, it has error: accept: Invalid argument
Platform or compiler specific questions are best asked in a
newsgroup where they are topical.
There are no functions accept(), perror(), fork(), close(), and
_exit() in standard C, so I won't say anything about their use.
comp.unix.progr ammer might be a good place to ask.
Your switch definitely lacks a default, though, to ward against
unexpected pid values. printf() debug from there...
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
On Wed, 16 Nov 2005 06:02:15 +0100, Michael Mair wrote: Yarco wrote: when doing fork in a loop: - while(1) {
- tmp_sd = accept(sd, (struct sockaddr*)&tmp_sin, &len);
- if (tmp_sd == -1) {
- perror("accept");
- exit(0);
- }
- //check client ip
- //fork
- pid = fork();
- switch(pid) {
- case -1:
- perror("fork");
- break;
- case 0:
- _exit(0);
- }
- close(tmp_sd);
- }
-
If there's no fork, the code done well. But if fork, when telnet, it has error: accept: Invalid argument
Platform or compiler specific questions are best asked in a newsgroup where they are topical. There are no functions accept(), perror(), fork(), close(), and _exit() in standard C, so I won't say anything about their use.
[snip]
Isn't perror() part of the standard? It's declared in stdio.h.
Regards,
Gary
Gary Baydo wrote: Isn't perror() part of the standard? It's declared in stdio.h.
perror() is in the standard library.
--
pete
Gary Baydo wrote: On Wed, 16 Nov 2005 06:02:15 +0100, Michael Mair wrote:
Yarco wrote:
when doing fork in a loop: - while(1) {
- tmp_sd = accept(sd, (struct sockaddr*)&tmp_sin, &len);
- if (tmp_sd == -1) {
- perror("accept");
- exit(0);
- }
- //check client ip
- //fork
- pid = fork();
- switch(pid) {
- case -1:
- perror("fork");
- break;
- case 0:
- _exit(0);
- }
- close(tmp_sd);
- }
If there's no fork, the code done well. But if fork, when telnet, it has error: accept: Invalid argument
Platform or compiler specific questions are best asked in a newsgroup where they are topical. There are no functions accept(), perror(), fork(), close(), and _exit() in standard C, so I won't say anything about their use.
[snip]
Isn't perror() part of the standard? It's declared in stdio.h.
You are right, thanks for the correction. I got carried away
before breakfast... I really should enforce my "no newsgroups
before caffeine" policy.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
>tmp_sd = accept(sd, (struct sockaddr*)&tmp_ sin, &len);
int
accept(int s,
struct sockaddr * restrict addr,
socklen_t * restrict addrlen);
///////////////////////////////////////
case 0: {
(void)printf("t est........?");
_exit(0);
}
>tmp_sd = accept(sd, (struct sockaddr*)&tmp_ sin, &len);
int
accept(int s,
struct sockaddr * restrict addr,
socklen_t * restrict addrlen);
///////////////////////////////////////
case 0: {
(void)printf("t est........?");
_exit(0);
}
>tmp_sd = accept(sd, (struct sockaddr*)&tmp_ sin, &len);
int
accept(int s,
struct sockaddr * restrict addr,
socklen_t * restrict addrlen);
///////////////////////////////////////
case 0: {
(void)printf("t est........?");
_exit(0);
}
>tmp_sd = accept(sd, (struct sockaddr*)&tmp_ sin, &len);
int
accept(int s,
struct sockaddr * restrict addr,
socklen_t * restrict addrlen);
///////////////////////////////////////
case 0: {
(void)printf("t est........?");
_exit(0);
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vincent wehren |
last post by:
Hi,
Trying to grasp Py_NewInterpreter()in a simple app embedding Python, I was
wondering why the following gives me an error:
int main() {
PyThreadState *tstate;
Py_Initialize();
|
by: Richard |
last post by:
I am writing a script which accesses a DBM file using SDBM. The
program works but throws out a warning of: -
Argument "O_RDWR" isn't numeric in null operation
I've included Fcntl but that doesn't solve the problem. Does anyone
why this is happening?
Thanks
|
by: Stephen Poley |
last post by:
Could some kind soul explain the errors and warnings that the W3C CSS
validator generates for page: http://www.atlis.nl/testsite/nl/
Results at: http://tinyurl.com/5pxqx
The error "Invalid number : borderParse Error - " may be
due to something I've done, but I'm blowed if I can see what.
While the warning "property display doesn't exist for media" has me
baffled.
|
by: Wally |
last post by:
I am trying to display images from an Access 2000 database and I get an error
"Invalid Parameter Used" when I execute the code line
"picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual Basic .Net
application.
I have researched MSDN for help and found the example article 321900 (see
below) and set up a test and everything works fine when I use SQL Server 2000
but when I modify the code and use data from Access 2000 using an...
|
by: Simon Harris |
last post by:
I'm trying to access a password protected web service. My code is as
follows:
Dim BS7666 As New bs7666.BS7666 'New instance of my web service
Dim CredCache As CredentialCache = New CredentialCache
Dim WebSvcURL As System.Uri = New System.Uri(BS7666.Url)
CredCache.Add(WebSvcURL, "Basic", New NetworkCredential("USERNAME",
"PASSWORD", "DOMAIN")) 'This is the line it fails on
BS7666.Credentials = CredCache
Dim DataSet_bs7666 As New...
| |
by: Patrick Dugan |
last post by:
Hello,
I'm trying to load different images (icons) into a PictureBox1.Image.
The first image loads just fine, but the second image always returns the
error "Invalid property used."
It doesn't matter what icons are loaded. The first always shows up and any
icons after that give me the error.
Here is the offending code:
The "DestinationPath" variable is the full path and filename of the icon
|
by: Arnold |
last post by:
I am having problem loading the image from the database. It gives this error:
"Invalid parameter used."
This is my source code:
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Dim strCn As String = "Data Source=DATABASE\BARCA;" & _
"Initial Catalog=MIS;Integrated Security=SSPI"
Dim cn As SqlConnection = New SqlConnection(strCn)
Dim fs As IO.FileStream
|
by: Martin |
last post by:
Hi,
I have an aspx page with two dropdownlist controls.
I update the options in the second ddl based on selection made in the first.
I do this with the ICallbackEventHandler interface, as per "Implementing
Client Callbacks Without Postbacks in ASP.NET Web Pages"
(http://msdn2.microsoft.com/en-us/library/ms178208.aspx)
This works.
|
by: Java Guy |
last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors
on the page. Here they are:
Line: 15
Char: 7
Error: Wrong number of arguments or invalid propert assignment
Code: 0
URL: http://(address.of.my.webcam):port/LiveView.html
and
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |