I have been looking at the code but can't seem to get:
sin.sin_addr = inet_makeaddr(
inet_network("1 93.188.43.36"),
inet_addr("193. 188.43.36"));
line working. Don't know what is wrong here it looks correct? How did you go after you added the include file is it working on your system?
User Profile
Collapse
-
Hi I had a look at the program, are you using LINIX?
if so try:
#include <netinet/in.h>
I believe you would probably find a few more errors downstream thoughLeave a comment:
-
I tried to compile this program using the following syntax:
g++ filename.c -o filename
Mainly because I couldn't see how it would work. C++ describes cin and cout as being able to split on a valid decimeter which it describes as a "a space, a tab character or a newline". Therefore the syntax:
cin >> day >> ch >> month >> ch >> year;
would not work...Leave a comment:
-
HI thanks for your response but I have figured out what is going wrong here. I had a look at tid1 and tid2 and re-read the man page fore pthread_create. From what I understand the command "pthread_create (&tid1, NULL, ThreadAdd, NULL)" will initialize tid1 to default values as the attr argument is NULL. The actual problem in the code was that MAC OS does not support POSIX style unamed semaphores but does support the older Mach style...Leave a comment:
-
Unexpected behavior from Semaphore
Hi I have been playing with a bit of code to teach myself how to use semaphores on my MAC OSX, however it does not appear to be working, here is a screen shot of what I am getting:
1. The value of the semaphors is 0
1. The value of the semaphors is 0
Bad file descriptor mutex returned -1
Here is the code that I have been playing with:
#include <pthread.h>
#include <semaphore.h>...
No activity results to display
Show More
Leave a comment: