Click here to Skip to main content
15,886,821 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Moving a STL container around Pin
Greg Utas16-Apr-22 1:00
professionalGreg Utas16-Apr-22 1:00 
GeneralRe: Moving a STL container around Pin
Calin Negru16-Apr-22 3:01
Calin Negru16-Apr-22 3:01 
GeneralRe: Moving a STL container around Pin
Richard MacCutchan16-Apr-22 5:59
mveRichard MacCutchan16-Apr-22 5:59 
GeneralRe: Moving a STL container around Pin
Calin Negru16-Apr-22 9:34
Calin Negru16-Apr-22 9:34 
QuestionMessage Closed Pin
5-Apr-22 16:02
Member 149687715-Apr-22 16:02 
AnswerRe: macro usage error Pin
Victor Nijegorodov5-Apr-22 20:35
Victor Nijegorodov5-Apr-22 20:35 
AnswerRe: macro usage error Pin
Richard MacCutchan5-Apr-22 21:24
mveRichard MacCutchan5-Apr-22 21:24 
Questionmain.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
Nagavarapu Pavan4-Apr-22 20:23
Nagavarapu Pavan4-Apr-22 20:23 
// Server side C/C++ program to demonstrate Socket programming
#include <unistd.h>
#include <stdio.h>
#include <sys socket.h="">
#include <stdlib.h>
#include <netinet in.h="">
#include <string.h>
#define PORT 8080
int main(int argc, char const *argv[])
{
int server_fd, new_socket, valread;
struct sockaddr_in address;
int opt = 1;
int addrlen = sizeof(address);
//int addrlen;
char buffer[1024] = {0};
char *hello = "Hello from server";

// Creating socket file descriptor
if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0)
{
perror("socket failed");
exit(EXIT_FAILURE);
}

// Forcefully attaching socket to the port 8080
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,&opt, sizeof(opt)))
{
perror("setsockopt");
exit(EXIT_FAILURE);
}
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons( PORT );

// Forcefully attaching socket to the port 8080


//if (bind(int sockfd, const struct sockaddr *addr,
// socklen_t addrlen)<0))

//if (bind(int server_fd,(const struct sockaddr *)&address,sizeof(address))<0)
if (bind(server_fd, (struct sockaddr *)&address,sizeof(address))<0)
{
perror("bind failed");
exit(EXIT_FAILURE);
}
if (listen(server_fd, 3) < 0)
{
perror("listen");
exit(EXIT_FAILURE);
}
if ((new_socket = accept(server_fd, (struct sockaddr *)&address,
(socklen_t*)&addrlen))<0)
{
perror("accept");
exit(EXIT_FAILURE);
}
valread = read( new_socket , buffer, 1024);
printf("%s\n",buffer );
send(new_socket , hello , strlen(hello) , 0 );
printf("Hello message sent\n");
return 0;
}
AnswerRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
CPallini4-Apr-22 21:47
mveCPallini4-Apr-22 21:47 
GeneralRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
Nagavarapu Pavan4-Apr-22 21:56
Nagavarapu Pavan4-Apr-22 21:56 
GeneralRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
CPallini4-Apr-22 22:46
mveCPallini4-Apr-22 22:46 
QuestionCan not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar1-Apr-22 10:17
Alex Banar1-Apr-22 10:17 
AnswerRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Victor Nijegorodov1-Apr-22 20:42
Victor Nijegorodov1-Apr-22 20:42 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar2-Apr-22 2:01
Alex Banar2-Apr-22 2:01 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Victor Nijegorodov2-Apr-22 2:55
Victor Nijegorodov2-Apr-22 2:55 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar2-Apr-22 10:08
Alex Banar2-Apr-22 10:08 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Richard MacCutchan3-Apr-22 23:12
mveRichard MacCutchan3-Apr-22 23:12 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Richard Andrew x644-Apr-22 6:49
professionalRichard Andrew x644-Apr-22 6:49 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Dave Kreskowiak2-Apr-22 4:46
mveDave Kreskowiak2-Apr-22 4:46 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar2-Apr-22 10:08
Alex Banar2-Apr-22 10:08 
QuestionSwitching a toolbar from Docked to Floating without restarting app? Pin
kittmaster31-Mar-22 11:59
kittmaster31-Mar-22 11:59 
AnswerRe: Switching a toolbar from Docked to Floating without restarting app? Pin
Randor 1-Apr-22 4:26
professional Randor 1-Apr-22 4:26 
GeneralRe: Switching a toolbar from Docked to Floating without restarting app? Pin
kittmaster1-Apr-22 6:06
kittmaster1-Apr-22 6:06 
GeneralRe: Switching a toolbar from Docked to Floating without restarting app? Pin
Randor 1-Apr-22 6:32
professional Randor 1-Apr-22 6:32 
GeneralRe: Switching a toolbar from Docked to Floating without restarting app? Pin
kittmaster1-Apr-22 9:37
kittmaster1-Apr-22 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.