SlideShare a Scribd company logo
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432
#define MAX_LINE 256
int main(int argc, char * argv[])
{
FILE *fp;
struct hostent *hp;
struct sockaddr_in sin;
char *host;
char buf[MAX_LINE];
int s;
int len;
if (argc==2) {
host = argv[1];
}
else {
fprintf(stderr, "usage: simplex-talk hostn");
exit(1);
}
/* translate host name into peer’s IP address */
hp = gethostbyname(host);
if (!hp) {
fprintf(stderr, "simplex-talk: unknown host: %sn",
host);
exit(1);
}
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
sin.sin_port = htons(SERVER_PORT);
/* active open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("simplex-talk: socket");
exit(1);
}
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
perror("simplex-talk: connect");
close(s);
exit(1);
}
/* main loop: get and send lines of text */
while (fgets(buf, sizeof(buf), stdin)) {
buf[MAX_LINE-1] = '0';
len = strlen(buf) + 1;
send(s, buf, len, 0);
}
}
Post your initial response to the Discussion Questions by
midnight on Thursday. Then by Sunday at midnight CST/CDT
you must provide a substantive response to two or
more classmates' posts. Use the concepts learned from the text
as well as from outside sources (at least two [2] are required)
for compiling the response to each Discussion Question. Cite
the sources used in the Discussion Question posting as well as
in the peer responses IAW APA Format.
Important: Your grade for the responses you post in our
Discussion Area will be determined not only by your responses
to the assignment questions, but also by your responses to your
fellow students' postings. Be sure to reply to at least one
posting for each Discussion Question. Otherwise, five points
will be deducted from your grade.
Discussion Questions
(Two questions from Chapter 6)
1. What industry forces might cause a propitious niche to appear
or disappear?
The environment or industry changes. The company or SBU
continues to make its products or services but the size of the
market changes. The company or SBU changes. The same
market demand continues for some specific products or services
but the company or SBU itself changes so that there is no longer
asynchronization between itself and the market. If a company or
SBU loses its niche, it is likely to get much less profitable
unless it gets a new niche. The specifics of what might happen
depends upon how the company had lost its niche. The
possibilities of class discussion can be almost endless.
2. What does a business have to consider when trying to follow
a cost leadership strategy and a differentiation strategy
simultaneously? Can you name a company doing this?
A cost leadership strategy is a “company’s ability to design,
produce, and market a comparable product more efficiently than
their competitors (Wheelen 2015).” A differentiation strategy is
a “company’s ability to provide unique and superior value to the
buyer in terms of product quality, special features, and after -
sale service (Wheelen 2015).” With that, if a business decides
to follow these two strategies simultaneously, it has to plan.
After finding a niche market, the company would need to
determine what price would be the most profitable for their
company as well as find a product that offers differentiation
(Thakur, 2014). An example of a company that does this is
Apple with their Iphones. In the electronic market, Apple and
Microsoft are dominating companies and they are often both
looking for ways to differentiate their product, while also
keeping their prices reasonable. With Apple, they offer product
quality as well as Apple only software including FaceTime and
Siri.
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432
#define MAX_PENDING 5
#define MAX_LINE 256
int main()
{
struct sockaddr_in sin;
char buf[MAX_LINE];
int len;
int s, new_s;
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(SERVER_PORT);
/* setup passive open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("simplex-talk: socket");
exit(1);
}
if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) {
perror("simplex-talk: bind");
exit(1);
}
listen(s, MAX_PENDING);
/* wait for connection, then receive and print text */
while(1) {
if ((new_s = accept(s, (struct sockaddr *)&sin, &len))
< 0) {
perror("simplex-talk: accept");
exit(1);
}
while (len = recv(new_s, buf, sizeof(buf), 0))
fputs(buf, stdout);
close(new_s);
}
}
/* server.c - code for example server program that uses TCP */
#ifndef unix
#define WIN32
#include <windows.h>
#include <winsock.h>
#else
#define closesocket close
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
#include <stdio.h>
#include <string.h>
#define PROTOPORT 5193 /* default protocol port number */
#define QLEN 6 /* size of request queue */
int visits = 0; /* counts client connections */
/*------------------------------------------------------------------------
* * Program: server
* *
* * Purpose: allocate a socket and then repeatedly execute the
following:
* * (1) wait for the next connection from a client
* * (2) send a short message to the client
* * (3) close the connection
* * (4) go back to step (1)
* * Syntax: server [ port ]
* *
* * port - protocol port number to use
* *
* * Note: The port argument is optional. If no port is specified,
* * the server uses the default given by PROTOPORT.
* *
* *----------------------------------------------------------------------
--
* */
main(argc, argv)
int argc;
char *argv[];
{
struct hostent *ptrh; /* pointer to a host table entry */
struct protoent *ptrp; /* pointer to a protocol table entry */
struct sockaddr_in sad; /* structure to hold server.s
address */
struct sockaddr_in cad; /* structure to hold client.s address
*/
int sd, sd2; /* socket descriptors */
int port; /* protocol port number */
int alen; /* length of address */
char buf[1000]; /* buffer for string the server sends */
#ifdef WIN32
WSADATA wsaData;
WSAStartup(0x0101, &wsaData);
#endif
memset((char *)&sad,0,sizeof(sad)); /* clear sockaddr
structure */
sad.sin_family = AF_INET; /* set family to Internet */
sad.sin_addr.s_addr = INADDR_ANY; /* set the local IP
address */
/* Check command-line argument for protocol port and
extract */
/* port number if one is specified. Otherwise, use the
default */
/* port value given by constant PROTOPORT */
if (argc > 1) { /* if argument specified */
port = atoi(argv[1]); /* convert argument to binary */
} else {
port = PROTOPORT; /* use default port number */
}
if (port > 0) /* test for illegal value */
sad.sin_port = htons((u_short)port);
else { /* print error message and exit */
fprintf(stderr,"bad port number %sn",argv[1]);
exit(1);
}
/* Map TCP transport protocol name to protocol number */
if ( ((int)(ptrp = getprotobyname("tcp"))) == 0) {
fprintf(stderr, "cannot map "tcp" to protocol
number");
exit(1);
}
/* Create a socket */
sd = socket(PF_INET, SOCK_STREAM, ptrp->p_proto);
if (sd < 0) {
fprintf(stderr, "socket creation failedn");
exit(1);
}
/* Bind a local address to the socket */
if (bind(sd, (struct sockaddr *)&sad, sizeof(sad)) < 0) {
fprintf(stderr,"bind failedn");
exit(1);
}
/* Specify size of request queue */
if (listen(sd, QLEN) < 0) {
fprintf(stderr,"listen failedn");
exit(1);
}
/* Main server loop - accept and handle requests */
while (1) {
alen = sizeof(cad);
if ( (sd2=accept(sd, (struct sockaddr *)&cad, &alen))
< 0) {
fprintf(stderr, "accept failedn");
exit(1);
}
visits++;
sprintf(buf,"This server has been contacted %d
time%sn",
visits,visits==1?".":"s.");
send(sd2,buf,strlen(buf),0);
closesocket(sd2);
}
}
/* client.c - code for example client program that uses TCP */
#ifndef unix
#define WIN32
#include <windows.h>
#include <winsock.h>
#else
#define closesocket close
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#endif
#include <stdio.h>
#include <string.h>
#define PROTOPORT 5193 /* default protocol port number */
extern int errno;
char localhost[] = "localhost"; /* default host name */
/*------------------------------------------------------------------------
* * Program: client
* *
* * Purpose: allocate a socket, connect to a server, and print all
output
* * Syntax: client [ host [port] ]
* *
* * host - name of a computer on which server is executing
* * port - protocol port number server is using
* *
* * Note: Both arguments are optional. If no host name is
specified,
* * the client uses "localhost"; if no protocol port is
* * specified, the client uses the default given by
PROTOPORT.
* *
* *----------------------------------------------------------------------
--
* */
main(argc, argv)
int argc;
char *argv[];
{
struct hostent *ptrh; /* pointer to a host table entry */
struct protoent *ptrp; /* pointer to a protocol table entry */
struct sockaddr_in sad; /* structure to hold an IP address
*/
int sd; /* socket descriptor */
int port; /* protocol port number */
char *host; /* pointer to host name */
int n; /* number of characters read */
char buf[1000]; /* buffer for data from the server */
#ifdef WIN32
WSADATA wsaData;
WSAStartup(0x0101, &wsaData);
#endif
memset((char *)&sad,0,sizeof(sad)); /* clear sockaddr
structure */
sad.sin_family = AF_INET; /* set family to Internet */
/* Check command-line argument for protocol port and
extract */
/* port number if one is specified. Otherwise, use the
default */
/* port value given by constant PROTOPORT */
if (argc > 2) { /* if protocol port specified */
port = atoi(argv[2]); /* convert to binary */
} else {
port = PROTOPORT; /* use default port number */
}
if (port > 0) /* test for legal value */
sad.sin_port = htons((u_short)por t);
else { /* print error message and exit */
fprintf(stderr,"bad port number %sn",argv[2]);
exit(1);
}
/* Check host argument and assign host name. */
if (argc > 1) {
host = argv[1]; /* if host argument specified */
} else {
host = localhost;
}
/* Convert host name to equivalent IP address and copy to
sad. */
ptrh = gethostbyname(host);
if ( ((char *)ptrh) == NULL ) {
fprintf(stderr,"invalid host: %sn", host);
exit(1);
}
memcpy(&sad.sin_addr, ptrh->h_addr, ptrh->h_length);
/* Map TCP transport protocol name to protocol number.
*/
if ( ((int)(ptrp = getprotobyname("tcp"))) == 0) {
fprintf(stderr, "cannot map "tcp" to protocol
number");
exit(1);
}
/* Create a socket. */
sd = socket(PF_INET, SOCK_STREAM, ptrp->p_proto);
if (sd < 0) {
fprintf(stderr, "socket creation failedn");
exit(1);
}
/* Connect the socket to the specified server. */
if (connect(sd, (struct sockaddr *)&sad, sizeof(sad)) < 0) {
fprintf(stderr,"connect failedn");
exit(1);
}
/* Repeatedly read data from socket and write to user.s
screen. */
n = recv(sd, buf, sizeof(buf), 0);
while (n > 0) {
write(1,buf,n);
printf("n: %dn", n);
n = recv(sd, buf, sizeof(buf), 0);
}
printf("n: %dn", n);
/* Close the socket. */
closesocket(sd);
/* Terminate the client program gracefully. */
exit(0);
}
#include stdio.h#include systypes.h#include syssocket.h

More Related Content

Similar to #include stdio.h#include systypes.h#include syssocket.h

망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7종인 전
 
Socket programming in c
Socket programming in cSocket programming in c
Socket programming in c
Md. Golam Hossain
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sk
sureshkarthick37
 
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
ajay1317
 
Server
ServerServer
Server
marveenstein
 
Multithreaded sockets c++11
Multithreaded sockets c++11Multithreaded sockets c++11
Multithreaded sockets c++11
Russell Childs
 
03 sockets
03 sockets03 sockets
03 sockets
Pavan Illa
 
Networking lab
Networking labNetworking lab
Networking lab
Ragu Ram
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
Vivek Kumar Sinha
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
MARRY7
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
Jignesh Patel
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8shanmuga priya
 
tp socket en C.pdf
tp socket en C.pdftp socket en C.pdf
tp socket en C.pdf
YoussefJamma
 
Os 2
Os 2Os 2
Socket System Calls
Socket System CallsSocket System Calls
Socket System Calls
Avinash Varma Kalidindi
 
Oops presentation
Oops presentationOops presentation
Oops presentation
sushamaGavarskar1
 
Arduino práctico ethernet
Arduino práctico   ethernetArduino práctico   ethernet
Arduino práctico ethernet
Jose Antonio Vacas
 

Similar to #include stdio.h#include systypes.h#include syssocket.h (20)

123
123123
123
 
망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7
 
Socket programming in c
Socket programming in cSocket programming in c
Socket programming in c
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sk
 
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf  proxyc  CSAPP Web proxy   NAME    IMPORTANT Giv.pdf
proxyc CSAPP Web proxy NAME IMPORTANT Giv.pdf
 
Server
ServerServer
Server
 
Multithreaded sockets c++11
Multithreaded sockets c++11Multithreaded sockets c++11
Multithreaded sockets c++11
 
03 sockets
03 sockets03 sockets
03 sockets
 
Networking lab
Networking labNetworking lab
Networking lab
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 
Sockets
SocketsSockets
Sockets
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8
 
UDP.yash
UDP.yashUDP.yash
UDP.yash
 
tp socket en C.pdf
tp socket en C.pdftp socket en C.pdf
tp socket en C.pdf
 
Os 2
Os 2Os 2
Os 2
 
Socket System Calls
Socket System CallsSocket System Calls
Socket System Calls
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
Arduino práctico ethernet
Arduino práctico   ethernetArduino práctico   ethernet
Arduino práctico ethernet
 

More from MoseStaton39

(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
MoseStaton39
 
(Remarks)Please keep in mind that the assi
(Remarks)Please keep in mind that the assi(Remarks)Please keep in mind that the assi
(Remarks)Please keep in mind that the assi
MoseStaton39
 
(This is provided as an example of the paper layout and spac
(This is provided as an example of the paper layout and spac(This is provided as an example of the paper layout and spac
(This is provided as an example of the paper layout and spac
MoseStaton39
 
(Student Name)Date of EncounterPreceptorClinical SiteCl
(Student Name)Date of EncounterPreceptorClinical SiteCl(Student Name)Date of EncounterPreceptorClinical SiteCl
(Student Name)Date of EncounterPreceptorClinical SiteCl
MoseStaton39
 
(TITLE)Sung Woo ParkInternational American UniversityFIN
(TITLE)Sung Woo ParkInternational American UniversityFIN(TITLE)Sung Woo ParkInternational American UniversityFIN
(TITLE)Sung Woo ParkInternational American UniversityFIN
MoseStaton39
 
(Student Name) UniversityDate of EncounterPreceptorClini
(Student Name) UniversityDate of EncounterPreceptorClini(Student Name) UniversityDate of EncounterPreceptorClini
(Student Name) UniversityDate of EncounterPreceptorClini
MoseStaton39
 
(Student Name)Miami Regional UniversityDate of Encounter
(Student Name)Miami Regional UniversityDate of Encounter(Student Name)Miami Regional UniversityDate of Encounter
(Student Name)Miami Regional UniversityDate of Encounter
MoseStaton39
 
(Student Name)Miami Regional UniversityDate of EncounterP
(Student Name)Miami Regional UniversityDate of EncounterP(Student Name)Miami Regional UniversityDate of EncounterP
(Student Name)Miami Regional UniversityDate of EncounterP
MoseStaton39
 
(Monica)Gender rarely shapes individual experience in isolation bu
(Monica)Gender rarely shapes individual experience in isolation bu(Monica)Gender rarely shapes individual experience in isolation bu
(Monica)Gender rarely shapes individual experience in isolation bu
MoseStaton39
 
(Monica) A summary of my decision-making process starts with flipp
(Monica) A summary of my decision-making process starts with flipp(Monica) A summary of my decision-making process starts with flipp
(Monica) A summary of my decision-making process starts with flipp
MoseStaton39
 
(Note This case study is based on many actual cases. All the name
(Note This case study is based on many actual cases. All the name(Note This case study is based on many actual cases. All the name
(Note This case study is based on many actual cases. All the name
MoseStaton39
 
(Minimum 175 words)In your own words, explain class conflict the
(Minimum 175 words)In your own words, explain class conflict the(Minimum 175 words)In your own words, explain class conflict the
(Minimum 175 words)In your own words, explain class conflict the
MoseStaton39
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D
MoseStaton39
 
(Kaitlyn)To be very honest I know next to nothing about mythology,
(Kaitlyn)To be very honest I know next to nothing about mythology,(Kaitlyn)To be very honest I know next to nothing about mythology,
(Kaitlyn)To be very honest I know next to nothing about mythology,
MoseStaton39
 
(Harry)Dante’s Inferno is the first of the three-part epic poem, D
(Harry)Dante’s Inferno is the first of the three-part epic poem, D(Harry)Dante’s Inferno is the first of the three-part epic poem, D
(Harry)Dante’s Inferno is the first of the three-part epic poem, D
MoseStaton39
 
(Lucious)Many steps in the systems development process may cause a
(Lucious)Many steps in the systems development process may cause a(Lucious)Many steps in the systems development process may cause a
(Lucious)Many steps in the systems development process may cause a
MoseStaton39
 
(Eric)Technology always seems simple when it works and it is when
(Eric)Technology always seems simple when it works and it is when (Eric)Technology always seems simple when it works and it is when
(Eric)Technology always seems simple when it works and it is when
MoseStaton39
 
(ELI)At the time when I first had to take a sociology class in hig
(ELI)At the time when I first had to take a sociology class in hig(ELI)At the time when I first had to take a sociology class in hig
(ELI)At the time when I first had to take a sociology class in hig
MoseStaton39
 
(Click icon for citation) Theme Approaches to History
(Click icon for citation) Theme Approaches to History(Click icon for citation) Theme Approaches to History
(Click icon for citation) Theme Approaches to History
MoseStaton39
 
(Executive Summary)MedStar Health Inc, a leader in the healthc
(Executive Summary)MedStar Health Inc, a leader in the healthc(Executive Summary)MedStar Health Inc, a leader in the healthc
(Executive Summary)MedStar Health Inc, a leader in the healthc
MoseStaton39
 

More from MoseStaton39 (20)

(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
(U) WHAT INSIGHTS ARE DERIVED FROM OPERATION ANACONDA IN REGARDS T
 
(Remarks)Please keep in mind that the assi
(Remarks)Please keep in mind that the assi(Remarks)Please keep in mind that the assi
(Remarks)Please keep in mind that the assi
 
(This is provided as an example of the paper layout and spac
(This is provided as an example of the paper layout and spac(This is provided as an example of the paper layout and spac
(This is provided as an example of the paper layout and spac
 
(Student Name)Date of EncounterPreceptorClinical SiteCl
(Student Name)Date of EncounterPreceptorClinical SiteCl(Student Name)Date of EncounterPreceptorClinical SiteCl
(Student Name)Date of EncounterPreceptorClinical SiteCl
 
(TITLE)Sung Woo ParkInternational American UniversityFIN
(TITLE)Sung Woo ParkInternational American UniversityFIN(TITLE)Sung Woo ParkInternational American UniversityFIN
(TITLE)Sung Woo ParkInternational American UniversityFIN
 
(Student Name) UniversityDate of EncounterPreceptorClini
(Student Name) UniversityDate of EncounterPreceptorClini(Student Name) UniversityDate of EncounterPreceptorClini
(Student Name) UniversityDate of EncounterPreceptorClini
 
(Student Name)Miami Regional UniversityDate of Encounter
(Student Name)Miami Regional UniversityDate of Encounter(Student Name)Miami Regional UniversityDate of Encounter
(Student Name)Miami Regional UniversityDate of Encounter
 
(Student Name)Miami Regional UniversityDate of EncounterP
(Student Name)Miami Regional UniversityDate of EncounterP(Student Name)Miami Regional UniversityDate of EncounterP
(Student Name)Miami Regional UniversityDate of EncounterP
 
(Monica)Gender rarely shapes individual experience in isolation bu
(Monica)Gender rarely shapes individual experience in isolation bu(Monica)Gender rarely shapes individual experience in isolation bu
(Monica)Gender rarely shapes individual experience in isolation bu
 
(Monica) A summary of my decision-making process starts with flipp
(Monica) A summary of my decision-making process starts with flipp(Monica) A summary of my decision-making process starts with flipp
(Monica) A summary of my decision-making process starts with flipp
 
(Note This case study is based on many actual cases. All the name
(Note This case study is based on many actual cases. All the name(Note This case study is based on many actual cases. All the name
(Note This case study is based on many actual cases. All the name
 
(Minimum 175 words)In your own words, explain class conflict the
(Minimum 175 words)In your own words, explain class conflict the(Minimum 175 words)In your own words, explain class conflict the
(Minimum 175 words)In your own words, explain class conflict the
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D
 
(Kaitlyn)To be very honest I know next to nothing about mythology,
(Kaitlyn)To be very honest I know next to nothing about mythology,(Kaitlyn)To be very honest I know next to nothing about mythology,
(Kaitlyn)To be very honest I know next to nothing about mythology,
 
(Harry)Dante’s Inferno is the first of the three-part epic poem, D
(Harry)Dante’s Inferno is the first of the three-part epic poem, D(Harry)Dante’s Inferno is the first of the three-part epic poem, D
(Harry)Dante’s Inferno is the first of the three-part epic poem, D
 
(Lucious)Many steps in the systems development process may cause a
(Lucious)Many steps in the systems development process may cause a(Lucious)Many steps in the systems development process may cause a
(Lucious)Many steps in the systems development process may cause a
 
(Eric)Technology always seems simple when it works and it is when
(Eric)Technology always seems simple when it works and it is when (Eric)Technology always seems simple when it works and it is when
(Eric)Technology always seems simple when it works and it is when
 
(ELI)At the time when I first had to take a sociology class in hig
(ELI)At the time when I first had to take a sociology class in hig(ELI)At the time when I first had to take a sociology class in hig
(ELI)At the time when I first had to take a sociology class in hig
 
(Click icon for citation) Theme Approaches to History
(Click icon for citation) Theme Approaches to History(Click icon for citation) Theme Approaches to History
(Click icon for citation) Theme Approaches to History
 
(Executive Summary)MedStar Health Inc, a leader in the healthc
(Executive Summary)MedStar Health Inc, a leader in the healthc(Executive Summary)MedStar Health Inc, a leader in the healthc
(Executive Summary)MedStar Health Inc, a leader in the healthc
 

Recently uploaded

S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
MERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDFMERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDF
scholarhattraining
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
amberjdewit93
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 

Recently uploaded (20)

S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
MERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDFMERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDF
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 

#include stdio.h#include systypes.h#include syssocket.h

  • 1. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define SERVER_PORT 5432 #define MAX_LINE 256 int main(int argc, char * argv[]) { FILE *fp; struct hostent *hp; struct sockaddr_in sin; char *host; char buf[MAX_LINE]; int s; int len; if (argc==2) { host = argv[1]; } else { fprintf(stderr, "usage: simplex-talk hostn"); exit(1); } /* translate host name into peer’s IP address */ hp = gethostbyname(host); if (!hp) { fprintf(stderr, "simplex-talk: unknown host: %sn", host); exit(1); } /* build address data structure */
  • 2. bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET; bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); sin.sin_port = htons(SERVER_PORT); /* active open */ if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket"); exit(1); } if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("simplex-talk: connect"); close(s); exit(1); } /* main loop: get and send lines of text */ while (fgets(buf, sizeof(buf), stdin)) { buf[MAX_LINE-1] = '0'; len = strlen(buf) + 1; send(s, buf, len, 0); } } Post your initial response to the Discussion Questions by midnight on Thursday. Then by Sunday at midnight CST/CDT you must provide a substantive response to two or more classmates' posts. Use the concepts learned from the text as well as from outside sources (at least two [2] are required) for compiling the response to each Discussion Question. Cite the sources used in the Discussion Question posting as well as in the peer responses IAW APA Format. Important: Your grade for the responses you post in our Discussion Area will be determined not only by your responses to the assignment questions, but also by your responses to your fellow students' postings. Be sure to reply to at least one posting for each Discussion Question. Otherwise, five points
  • 3. will be deducted from your grade. Discussion Questions (Two questions from Chapter 6) 1. What industry forces might cause a propitious niche to appear or disappear? The environment or industry changes. The company or SBU continues to make its products or services but the size of the market changes. The company or SBU changes. The same market demand continues for some specific products or services but the company or SBU itself changes so that there is no longer asynchronization between itself and the market. If a company or SBU loses its niche, it is likely to get much less profitable unless it gets a new niche. The specifics of what might happen depends upon how the company had lost its niche. The possibilities of class discussion can be almost endless. 2. What does a business have to consider when trying to follow a cost leadership strategy and a differentiation strategy simultaneously? Can you name a company doing this? A cost leadership strategy is a “company’s ability to design, produce, and market a comparable product more efficiently than their competitors (Wheelen 2015).” A differentiation strategy is a “company’s ability to provide unique and superior value to the buyer in terms of product quality, special features, and after - sale service (Wheelen 2015).” With that, if a business decides to follow these two strategies simultaneously, it has to plan. After finding a niche market, the company would need to determine what price would be the most profitable for their company as well as find a product that offers differentiation (Thakur, 2014). An example of a company that does this is Apple with their Iphones. In the electronic market, Apple and Microsoft are dominating companies and they are often both looking for ways to differentiate their product, while also
  • 4. keeping their prices reasonable. With Apple, they offer product quality as well as Apple only software including FaceTime and Siri. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define SERVER_PORT 5432 #define MAX_PENDING 5 #define MAX_LINE 256 int main() { struct sockaddr_in sin; char buf[MAX_LINE]; int len; int s, new_s; /* build address data structure */ bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(SERVER_PORT); /* setup passive open */ if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket"); exit(1); } if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) { perror("simplex-talk: bind"); exit(1); } listen(s, MAX_PENDING);
  • 5. /* wait for connection, then receive and print text */ while(1) { if ((new_s = accept(s, (struct sockaddr *)&sin, &len)) < 0) { perror("simplex-talk: accept"); exit(1); } while (len = recv(new_s, buf, sizeof(buf), 0)) fputs(buf, stdout); close(new_s); } } /* server.c - code for example server program that uses TCP */ #ifndef unix #define WIN32 #include <windows.h> #include <winsock.h> #else #define closesocket close #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #endif #include <stdio.h> #include <string.h> #define PROTOPORT 5193 /* default protocol port number */ #define QLEN 6 /* size of request queue */ int visits = 0; /* counts client connections */ /*------------------------------------------------------------------------ * * Program: server * * * * Purpose: allocate a socket and then repeatedly execute the
  • 6. following: * * (1) wait for the next connection from a client * * (2) send a short message to the client * * (3) close the connection * * (4) go back to step (1) * * Syntax: server [ port ] * * * * port - protocol port number to use * * * * Note: The port argument is optional. If no port is specified, * * the server uses the default given by PROTOPORT. * * * *---------------------------------------------------------------------- -- * */ main(argc, argv) int argc; char *argv[]; { struct hostent *ptrh; /* pointer to a host table entry */ struct protoent *ptrp; /* pointer to a protocol table entry */ struct sockaddr_in sad; /* structure to hold server.s address */ struct sockaddr_in cad; /* structure to hold client.s address */ int sd, sd2; /* socket descriptors */ int port; /* protocol port number */ int alen; /* length of address */ char buf[1000]; /* buffer for string the server sends */ #ifdef WIN32 WSADATA wsaData; WSAStartup(0x0101, &wsaData); #endif memset((char *)&sad,0,sizeof(sad)); /* clear sockaddr structure */ sad.sin_family = AF_INET; /* set family to Internet */
  • 7. sad.sin_addr.s_addr = INADDR_ANY; /* set the local IP address */ /* Check command-line argument for protocol port and extract */ /* port number if one is specified. Otherwise, use the default */ /* port value given by constant PROTOPORT */ if (argc > 1) { /* if argument specified */ port = atoi(argv[1]); /* convert argument to binary */ } else { port = PROTOPORT; /* use default port number */ } if (port > 0) /* test for illegal value */ sad.sin_port = htons((u_short)port); else { /* print error message and exit */ fprintf(stderr,"bad port number %sn",argv[1]); exit(1); } /* Map TCP transport protocol name to protocol number */ if ( ((int)(ptrp = getprotobyname("tcp"))) == 0) { fprintf(stderr, "cannot map "tcp" to protocol number"); exit(1); } /* Create a socket */ sd = socket(PF_INET, SOCK_STREAM, ptrp->p_proto); if (sd < 0) { fprintf(stderr, "socket creation failedn"); exit(1); } /* Bind a local address to the socket */ if (bind(sd, (struct sockaddr *)&sad, sizeof(sad)) < 0) { fprintf(stderr,"bind failedn"); exit(1); } /* Specify size of request queue */
  • 8. if (listen(sd, QLEN) < 0) { fprintf(stderr,"listen failedn"); exit(1); } /* Main server loop - accept and handle requests */ while (1) { alen = sizeof(cad); if ( (sd2=accept(sd, (struct sockaddr *)&cad, &alen)) < 0) { fprintf(stderr, "accept failedn"); exit(1); } visits++; sprintf(buf,"This server has been contacted %d time%sn", visits,visits==1?".":"s."); send(sd2,buf,strlen(buf),0); closesocket(sd2); } } /* client.c - code for example client program that uses TCP */ #ifndef unix #define WIN32 #include <windows.h> #include <winsock.h> #else #define closesocket close #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #endif #include <stdio.h>
  • 9. #include <string.h> #define PROTOPORT 5193 /* default protocol port number */ extern int errno; char localhost[] = "localhost"; /* default host name */ /*------------------------------------------------------------------------ * * Program: client * * * * Purpose: allocate a socket, connect to a server, and print all output * * Syntax: client [ host [port] ] * * * * host - name of a computer on which server is executing * * port - protocol port number server is using * * * * Note: Both arguments are optional. If no host name is specified, * * the client uses "localhost"; if no protocol port is * * specified, the client uses the default given by PROTOPORT. * * * *---------------------------------------------------------------------- -- * */ main(argc, argv) int argc; char *argv[]; { struct hostent *ptrh; /* pointer to a host table entry */ struct protoent *ptrp; /* pointer to a protocol table entry */ struct sockaddr_in sad; /* structure to hold an IP address */ int sd; /* socket descriptor */ int port; /* protocol port number */ char *host; /* pointer to host name */ int n; /* number of characters read */ char buf[1000]; /* buffer for data from the server */
  • 10. #ifdef WIN32 WSADATA wsaData; WSAStartup(0x0101, &wsaData); #endif memset((char *)&sad,0,sizeof(sad)); /* clear sockaddr structure */ sad.sin_family = AF_INET; /* set family to Internet */ /* Check command-line argument for protocol port and extract */ /* port number if one is specified. Otherwise, use the default */ /* port value given by constant PROTOPORT */ if (argc > 2) { /* if protocol port specified */ port = atoi(argv[2]); /* convert to binary */ } else { port = PROTOPORT; /* use default port number */ } if (port > 0) /* test for legal value */ sad.sin_port = htons((u_short)por t); else { /* print error message and exit */ fprintf(stderr,"bad port number %sn",argv[2]); exit(1); } /* Check host argument and assign host name. */ if (argc > 1) { host = argv[1]; /* if host argument specified */ } else { host = localhost; } /* Convert host name to equivalent IP address and copy to sad. */ ptrh = gethostbyname(host); if ( ((char *)ptrh) == NULL ) { fprintf(stderr,"invalid host: %sn", host); exit(1); }
  • 11. memcpy(&sad.sin_addr, ptrh->h_addr, ptrh->h_length); /* Map TCP transport protocol name to protocol number. */ if ( ((int)(ptrp = getprotobyname("tcp"))) == 0) { fprintf(stderr, "cannot map "tcp" to protocol number"); exit(1); } /* Create a socket. */ sd = socket(PF_INET, SOCK_STREAM, ptrp->p_proto); if (sd < 0) { fprintf(stderr, "socket creation failedn"); exit(1); } /* Connect the socket to the specified server. */ if (connect(sd, (struct sockaddr *)&sad, sizeof(sad)) < 0) { fprintf(stderr,"connect failedn"); exit(1); } /* Repeatedly read data from socket and write to user.s screen. */ n = recv(sd, buf, sizeof(buf), 0); while (n > 0) { write(1,buf,n); printf("n: %dn", n); n = recv(sd, buf, sizeof(buf), 0); } printf("n: %dn", n); /* Close the socket. */ closesocket(sd); /* Terminate the client program gracefully. */ exit(0); }