Hi,
I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. Here are the error codes and underneath i have listed the program. Thanks in advance for looking. - client.c: In function `main':
-
client.c:118: error: syntax error before '-' token
-
client.c: At top level:
-
client.c:132: error: conflicting types for `close_socket'
-
sockets.c.h:40: error: previous declaration of `close_socket'
-
client.c:133: error: parse error before '}' token
- /*client.c - demonstration client program. Written in C Nov '94 from
-
Pascal version of Nov/Dec '93
-
revised Oct 2005 to use stdio */
-
-
#include <stdio.h>
-
#include "sockets.c.h"
-
-
main()
-
{
-
-
host_name server;
-
port_number port;
-
socket_id local_socket;
-
int ok,i,len;
-
socket_buffer data;
-
char id[50];
-
char box[5];
-
char ack[50];
-
int boxlenerr;
-
char view_data[256];
-
-
printf("client ...\n");
-
printf("please enter host server name\n");
-
scanf("%s",server);
-
printf("please enter server port number\n");
-
scanf("%d",&port); /* remember the "&" to allow scanf to store the input value */
-
-
local_socket = create_socket();
-
printf("client: socket %d created\n", local_socket);
-
-
ok=connect_sockets(local_socket, server, port);
-
/* socket is connected at this point */
-
-
printf("Please enter your SetTopBox Number\t");
-
scanf("%s",box);
-
-
if (strlen(box) !=10)
-
{
-
printf("Incorrect box number, please try again later\n");
-
}
-
else
-
{
-
send_data(local_socket,box,strlen(box)+1);
-
recv_data(local_socket,ack);
-
}
-
-
printf("Please enter your Customer ID\t");
-
scanf("%s",id);
-
-
if (strlen(id) !=4)
-
{
-
printf("Your ID number needs to be 4 digits long\n");
-
}
-
else
-
{
-
send_data(local_socket,id,strlen(id)+1);
-
recv_data(local_socket,ack);
-
}
-
-
int option;
-
option = 0;
-
printf("NuTV SELECTION MENU");
-
while (option !=4)
-
{
-
display_menu();
-
option = get_selection();
-
switch (option)
-
{
-
case 1: get_prog_ch();
-
break;
-
case 2 : get_prog_cat();
-
break;
-
case 3 : get_prog_sub();
-
break;
-
}
-
}
-
printf(" Thanks for calling Goodbye\n\n");
-
-
if (ok < 0)
-
{
-
printf("failed to connect sockets\n");
-
}
-
else
-
{
-
printf("client: connection made to server, now use service\n");
-
-
len=recv_data(local_socket,data);
-
-
printf("client: %d bytes of data received\n",len);
-
-
/* now display the data received, character by character */
-
for (i=0;i<len;i++)
-
{ printf("%c",data[i]);
-
}
-
printf("\n");
-
}
-
-
void display_menu()
-
{
-
printf("\n");
-
printf("Please choose an option\n");
-
printf("1-Choose programmes by channel number\n");
-
printf("2-Choose programmes by category\n");
-
printf("3-Choose programmes bt ctegory & sub-categroy\n");
-
printf("4- Exit the system\n");
-
}
-
-
int get_selection()
-
{
-
int ch =0;
-
while (ch >3 && ch <1)
-
{printf("please enter your choice (1-3) and press return:\n");
-
scanf("%d",&ch);
-
}
-
return (ch);
-
}
-
-
void get_prog-ch()
-
{
-
printf(" this gets you the channels");
-
}
-
-
void get_prog_cat()
-
{
-
printf(" By category");
-
}
-
-
void get_prog_sub()
-
{
-
printf("By sub category");
-
}
-
-
-
}
-
-
4 2202
Check your curly brackets; I suspect you forgot one just before the display_menu
function. Other things might be wrong too; carefully read what your compiler has
to say about it.
kind regards,
Jos
Ok have looked at them all and have found a couple of problems that i have since sorted. However now when i try to compile i get a new error message : - [r020032@jaguar sockets1]$ make
-
gcc -w stream_sockets.o client.c -o client
-
display_menu
-
get_selection
-
get_prog_ch
-
get_prog_cat
-
get_prog_sub
-
collect2: ld returned 1 exit status
-
*** Exit 1
-
Stop.
Can you please explain what is going on here ?
I was about to start a new thread, but I think this is the one i need.
I'm getting some conflicting types errors too, what does it mean?
./include/tipos.h:16: error: conflicting types for ‘packet’
./include/tipos.h:16: error: previous declaration of ‘packet’ was here
./include/tipos.h:27: error: conflicting types for ‘frame’
./include/tipos.h:27: error: previous declaration of ‘frame’ was here
./include/tipos.h:34: error: conflicting types for ‘arguments’
./include/tipos.h:34: error: previous declaration of ‘arguments’ was here
./include/tipos.h:36: error: conflicting types for ‘to_physical_layer’
./include/tipos.h:36: error: previous declaration of ‘to_physical_layer’ was here
./include/tipos.h:37: error: conflicting types for ‘from_physical_layer’
./include/tipos.h:37: error: previous declaration of ‘from_physical_layer’ was here
./include/tipos.h:38: error: conflicting types for ‘format_frame’
./include/tipos.h:38: error: previous declaration of ‘format_frame’ was here
I was about to start a new thread, but I think this is the one i need.
I'm getting some conflicting types errors too, what does it mean?
./include/tipos.h:16: error: conflicting types for ‘packet’
./include/tipos.h:16: error: previous declaration of ‘packet’ was here
./include/tipos.h:27: error: conflicting types for ‘frame’
./include/tipos.h:27: error: previous declaration of ‘frame’ was here
./include/tipos.h:34: error: conflicting types for ‘arguments’
./include/tipos.h:34: error: previous declaration of ‘arguments’ was here
./include/tipos.h:36: error: conflicting types for ‘to_physical_layer’
./include/tipos.h:36: error: previous declaration of ‘to_physical_layer’ was here
./include/tipos.h:37: error: conflicting types for ‘from_physical_layer’
./include/tipos.h:37: error: previous declaration of ‘from_physical_layer’ was here
./include/tipos.h:38: error: conflicting types for ‘format_frame’
./include/tipos.h:38: error: previous declaration of ‘format_frame’ was here
Start a new thread about this... post your code as well, it would help in figuring out what is indeed the problem.
-blazed
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mark Oueis |
last post by:
I've been struggling with this question for a while. What is better
design? To design functions to return error codes when an error
occures, or to...
|
by: Shane Groff |
last post by:
I know this is a recurring discussion (I've spent the last 3 days
reading through threads on the topic), but I feel compelled to start
it up again....
|
by: Daniel O'Connell [C# MVP] |
last post by:
Does anyone know of a list of csc error codes other than the one in the MSDN
documentation. Hunting through one codes per topic is a little...
|
by: HKSHK |
last post by:
This list compares the error codes used in VB.NET 2003 with those used
in VB6.
Error Codes:
============
3: This Error number is obsolete and...
|
by: Tran Hong Quang |
last post by:
Hi,
In header file, I see this declaration:
#define DECLARE_VTBL(iname) iname vt##iname;
then, in C file, there are below codes:
...
|
by: PW |
last post by:
Hi,
There is code in Alison Balter's excellant "Mastering Access 2003" to
create a list of error codes and descriptions but it only generates...
|
by: mike3 |
last post by:
Hi.
(crossposted because the program is in C++ and some C++-related
elements are discussed, hence comp.lang.c++, plus general program
design...
|
by: pallavi814 |
last post by:
Hi ,
When i search for the DB2 error codes,some of the DB2 error codes donot list the sql code. For example,"SQL0004N - The password is not valid...
|
by: =?GB2312?B?17/HvyBaaHVvLCBRaWFuZw==?= |
last post by:
Hi,
I would like to have someone comments on what's the best practice
defining error codes in C.
Here's what I think:
solution A:
using enum...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
| |