473,671 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

storage size of 'sin' isn't known

1 New Member
hi,

i'm having the problem with my first socket program...i have been staring at it for an hour but i cant find whats wrong with it...can u check it out pls?

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/socket.h>
  4.  
  5. int main(){
  6.  
  7.  
  8.     struct hostent *phe;
  9.     struct sockaddr_in sin; //here is the problem!!!!!
  10.     char *host;
  11.     int s, rc, type;
  12.  
  13.     host = "tombaker.cis.um.edu.mt";
  14.     //memset(&sin, 0, sizeof(sin));
  15.  
  16.     sin.sin_family = AF_INET;
  17.     sin.sin_port = 7; //ECHO service
  18.     sin.sin_addr = inet_makeaddr(
  19.             inet_network("193.188.43.36"),
  20.             inet_addr("193.188.43.36"));
  21.     s= socket(PF_INET, SOCK_STREAM, 0);
  22.     rc = connect(s, (struct sockaddr *)&sin, sizof(sin));
  23.     if (rc != 0)
  24.      printf("failed");
  25.     else (printf("connected"));
  26.  
  27. }
Oct 15 '08 #1
3 6901
gpraghuram
1,275 Recognized Expert Top Contributor
In which OS you are doing this?
Becos the sockaddr_in is definde in different header file and you are missing that inclusion


Raghu
Oct 16 '08 #2
azzmosphere
5 New Member
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 though
Oct 21 '08 #3
azzmosphere
5 New Member
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?
Oct 22 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4878
by: franky.backeljauw | last post by:
Hello, I have the following code: <code> class X { ___ sin(); } X sin( X ) { return sin( y, x ); }
1
1306
by: DiskMan | last post by:
System: Redhat 7.2 Kernel-2.6.11.8 GCC-3.4.3 CCC-6.5.9 Binutils-2.15 Make-3.80 GTK/GLIB-2.6.7 For some reason my Linux box is suddenly having issues trying to read ;
12
5532
by: Jeremy | last post by:
Hi all, I'm getting very confused about how DB2 uses shared memory and I wonder if someone could clarify matters for me, please ? We are running 32bit DB2 V7.2 FP9 under AIX 4.3.3 on a machine with 64 Gb of memory with a single non-partitioned database using extended storage and with intra-parallelism enabled. I've been experimenting with changing various parameters in an attempt
1
8424
by: Madhusuthanan Seetharam | last post by:
Hi all, I'm a newbie to C. What does the error message "storage size of 'xxxxx' isn't known mean? TIA, - Madhu
2
6560
by: Gvs | last post by:
Hi, I'm trying to compile an example semaphore .c file taken straight from the internet, but it won't compile with the error; gcc seminit.c -o seminit seminit.c: In function `main': seminit.c:16: error: storage size of 'arg' isn't known Does anyone know how to correct this error.??
3
2718
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released storage Keywords.Keyword reachable from global A global variable does not satisfy its annotations when control is transferred. (Use -globstate to inhibit warning) keywords.c:60:11: Storage Keywords.Keyword released
5
28893
by: walsht | last post by:
When I compile the code snipets below I'm producing the error: storage size of 'frm' isn't known. dll.h : /* * File: dll.cpp * Defines the data link layer's interface. */ #ifndef __FRAME_
3
11909
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I get a strange compile error when compile such simple program. Any ideas? foo.c: In function `main': foo.c:5: error: storage size of 'var' isn't known foo.c
7
8127
by: bowlderster | last post by:
Hello,all. I want to get the array size in a function, and the array is an argument of the function. I try the following code. /*************************************** */ #include<stdio.h> #include<stdlib.h> #include<math.h>
0
8478
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8397
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8919
Oralloy
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...
0
8821
jinu1996
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...
1
8599
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,...
1
6230
isladogs
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...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.