Programming :: Socket C++ / Send And Receive Messages In Server?

Jan 2, 2009

I'm trying implement a small server for a university work, my server is creating, binding and listening but it don't accept any connection, these are the files I'm using in server:

Code:

// Definition of the Socket class
#ifndef SOCKET_H
#define SOCKET_H
#include <sys/types.h>
code....

I've made a client just for test it, but no ones run well, the server is always returning -1 when accept is called!!

What should I do to send and receive messages in this server??

View 3 Replies


ADVERTISEMENT

Ubuntu :: USB E1550 Modem - Cannot Send Or Receive Messages

Jul 19, 2010

I have USB modem huawei1550 and it work nice but I have one problem that I cant send or Receive messages because my pc dont recognize my usb as usb modem.

View 2 Replies View Related

Programming :: Perl - UDP Server Receive / Send Packet To Host

Apr 1, 2010

I have found many examples out on the www for creating udp servers with sockets. The problem I am running into is after I receive the packet from a host I need to be able to send a custom made packet(I'm using RawIP / NetPacket to make my packet) back to this host. The only way to do this is seemingly through the send() function. This function however doesn't appear to allow me to specify which host to send my packet to.

View 2 Replies View Related

Ubuntu Networking :: Email Account At Laposte.net - Can Receive Messages But Cannot Send Any From Thunderbird

Apr 26, 2011

I created a new account on laposte.net.

This account can receive messages but cannot send any from Thunderbird.

[url]

View 1 Replies View Related

Programming :: Send A UDP Msg Across A Socket?

Jan 24, 2011

Has anyone had an issue with gdb not being able to send a UDP msg across a socket?

I have ComponentA sending a msg to ComponentB utilizing gdb. ComponentB gets the msg. ComponentB sends a msg to ComponentC. ComponentC does stuff to the msg and sends a msg back to ComponentB using gdb.
ComponentB never seems to receive the 2nd message.

If I don't use gdb the messages Tx and Rx without an issue.

I'm flying blind without gdb to figure out a different bug.

View 3 Replies View Related

Programming :: Non Blocking Socket Send

Mar 7, 2011

Been trying all sorts of different things to implement a non-blocking send on a TCP server socket.As I kill the client, the server keeps blocking on the send no matter what. Am I missing something? Any other way to do that without involving any additional thread?

View 4 Replies View Related

Programming :: How To Send And Receive Packets Using Libpcap

Mar 11, 2011

How can I send and receive packets using libpcap, reply as early as possible.

View 1 Replies View Related

Programming :: Send Text File Over Socket

Nov 20, 2008

how can i send a text file from server to client? the problem is, i dont know how to send those two file to the client ( center node)

View 1 Replies View Related

Programming :: Send File Through Raw Socket Using C Programming

Jul 23, 2010

I am currently doing a research on video transmission over wireless LAN. I tend to transmit my offline file (xx.svc) from server to client.It may sound stupid (since I have a very little knowledge about c programming and raw socket), but my biggest challenges is that when I want to write the file to the buffer, how actually to define/include the file at the programming coding? where I need to locate the file? Is it at the same folder with my c programming, or somewhere in the linuxinclude folder?

Can anyone just give a simple example on how to include a file and write it into a buffer before send it through raw socket.

View 14 Replies View Related

Programming :: Socket Programming Send File

Jun 22, 2009

this is my client and server. I can receive text file. but I can't send other type of file like PDF,Docx,Odt

View 11 Replies View Related

Programming :: Send /receive Data Through Serial Port In Fedora?

Dec 27, 2010

I am doing work on serial port. I want to send/receive data to/from Microcontrolar through serial port. But I don't know how to initialize, receive and send data to Serial port. i am new in fedora so i hav'nt any deep concept of fedora.can anyone send me C code , which communicate through serial port in fedora (or atleast help me). I am using Fedora 11.

View 6 Replies View Related

Programming :: Plan Of Action For Script Which Is Able To Send / Receive Email

Feb 22, 2010

A bit clumsy subject, but I would like to make a script, which is able to send and receive email messages from CLI. The script should work like this:

1. read user input from stdin(for example a mail address)
2. send mail over SMTP(SSL, port 465) to a mail server
3. mail server sends an automatic response, script should just display this response email sent from mail server over IMAP(port 993)

At the moment I have a fallowing configuration in my Thunderbird:

Code:
IMAP mail.domain.com SSL 993
SMTP mail.domain.com SSL 465

Is it possible with 'mail' utility? Do I need to configure some sort of MTA at first(I use SUSE and I have Sendmail installed by default)? What are the steps, to get this script working?

View 1 Replies View Related

Server :: Cannot Receive/send Email?

May 2, 2011

I used this tutorial to setup to setup iSpconfig postfix courier:but i cannot send or receive email:

Code:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
B450C72116A 595 Mon May 2 17:33:50 www-data@mail.greensevenstudios.com

[code]...

View 2 Replies View Related

Server :: Postfix Can Send But Cannot Receive Emails?

Apr 25, 2009

I have configured Postfix on a Ubuntu 8.04 box using this tutorial:I can send emails but I cannot receive any email because of a "bad recipient address syntax:"The log from /var/log/mail.info says this:

Code:
Apr 25 14:46:06 360romania postfix/pickup[31716]: 74A682190661: uid=0 from=<root>
Apr 25 14:46:06 360romania postfix/cleanup[32402]: 74A682190661: message-

[code]...

View 9 Replies View Related

CentOS 5 Server :: Can't Send Or Receive Mail

May 24, 2010

My server already installed and works well, but I can't send or receive mail with Squirrelmail, the error that appears is: Server replied: 67 Can not execute command '/ usr / sbin / sendmail-t-i-fteste@gabinetedeengenharia.com '.

View 5 Replies View Related

Ubuntu Servers :: Mail Server - Can't Send Or Receive?

Mar 5, 2011

Every time I try to send a message with SquirrelMail, I get:

Code:
Message not sent. Server replied: Syntax error in parameters or arguments 501 5.1.7 Bad sender address syntax

View 3 Replies View Related

CentOS 5 Server :: Can Send Mail But Cannot Receive - No Errors

Aug 21, 2011

I recently purchased a domain and I have setup what I believe are correct dns records from the domain companies control panel. I have the domain pointing to my server and that's working fine. I also have an MX record for my domain. Now, I can send emails from my email account just fine however I cannot receive any emails coming in to my account. Heres an example:

[dalton@int-interactive mail]$ echo "hello world" | sendmail -v dalton@int-interactive.com
dalton@int-interactive.com... Connecting to [127.0.0.1] via relay...
220 int-interactive.com ESMTP Sendmail 8.13.8/8.13.8; Sun, 21 Aug 2011 14:45:16 -0400

[code]...

View 3 Replies View Related

Server :: Send And Receive E-mails To And From An Array Of Virtual Domains?

Jan 4, 2010

I've set up a fully functional e-mail server and can send and receive e-mails to and from an array of virtual domains without a problem. The only hiccup I have is that only root is able to send e-mails via mutt. I have not stipulated a sendmail line in the mutt configuration so it's sending e-mail with default configuration. How can I get it so that all users on the server can send outgoing e-mails via mutt?

Update: Solved this by following this http://inmyplace.info/2008/05/07/pos...ission-denied/

View 1 Replies View Related

Server :: Send And Receive Time Out Error In Microsoft Outlook?

Dec 21, 2010

the mail server being used in my office is qmail. now i have received some complains from people that they are getting time outs while sending or receiving mails in their email clients like microsoft outlook.

View 6 Replies View Related

Server :: Postfix - One Account Cannot Send / Receive Email (Other Works Fine)

Dec 7, 2010

I just set up a new email server on Debian Lenny. It's Postfix for MTA and Dovecot for IMAPS server. I use Dovecot for authentication. I have two UNIX users on the system (except root), one was added before the installation of Postfix and Dovecot. I'm not doing any virtual things, just plain UNIX users and one domain on a dynamic IP. The first user, "webadmin" can send and receive emails just fine through the server from my mail client.

Now I just added a new user, "scarleo", and it turns out I'm unable to send and receive emails with this account. If I log in (SSH) with scarleo I can use bash mail to send emails, works fine. scarleo can also receive emails from webadmin and can connect to Dovecot to read emails. However scarleo cannot send or receive to or from anyone outside the server from my mail client. I have restarted both Postfix and Dovecot after adding the user. Do I have to do something else to make this account work like webadmin's?

A few relevant lines from mail.log: (I've modded my real IP)
Code:
Dec 7 17:44:42 homer dovecot: imap-login: Login: user=<scarleo>, method=PLAIN, rip=96.136.112.229, lip=192.168.0.18, TLS
Dec 7 17:44:42 homer dovecot: imap-login: Login: user=<webadmin>, method=PLAIN, rip=96.136.112.229, lip=192.168.0.18, TLS
Dec 7 17:45:16 homer postfix/smtpd[5915]: connect from bredband.comhem.se[96.136.112.229] .....

View 4 Replies View Related

Server :: Configure Sendmail To Send Only Messages?

Mar 19, 2010

I have to configure sendmail to send messages only and not receiving any mails on a linux server when the mail server is on another server.how to configure sendmail?

View 5 Replies View Related

Ubuntu :: Send Messages, With 20+ Accounts ( Different Emails, But One Domain / SMTP Server )?

Jul 21, 2011

Has thunderbird (recent version) have a "TEST" function ? basically, i'm trying to send messages, with 20+ accounts (different emails, but one domain / SMTP server). one account works fine - the other one doesn't. i go to my "outgoing server" & everything is fine - usernames / ports etc..) The settings for each account do show the right outgoing server. If i 'send later' & close down thunderbird, 7 re-open - it asks me for my password again (which it saves), & then it is able to send the email.

QUESTION :- is there a TESt option that will test each & EVERY account in one timeslot ? Ie, will go through each email address - sends an email to itself (the same address), & sends it. it will then try the server again, to see if the email was received. & then give me a single report, of all the incorrect settings.(I've tried this 1 email account half a dozen times tonight & i dont know *WHY* its not sending on the 1st go.. )

View 1 Replies View Related

Programming :: Socket Programming - Detect Whether A Client Socket Is Closed / Active?

Mar 8, 2011

iam just trying to connect to server which accepts one client and server will read(blocking operation) infinitely, but After closing the client socket the server "read operation" is returning zero and "errno variable(in errno.h)" value is also zero. how can i detect whether a client socket is closed/active..?

client.c
Serv_Addr.sin_family = AF_INET;
Serv_Addr.sin_addr.s_addr = inet_addr("127.0.0.1");
Serv_Addr.sin_port = htons(26553);
if( 0 > connect (Serv_Fds,&Serv_Addr,sizeof(Serv_Addr)) )
{
perror("connect");
return 0;
[Code]....

View 3 Replies View Related

Programming :: Socket And Timer Programming - Server Doesn't Execute Any Msg Which Client Sent

May 16, 2011

i have a server program which accept multiple client connection and am using polling. like every 2 secs it will look to client whether any data is received after it binded. i have used setitimer but there is runtime error i got.. the server accept all client connection but doesn't execute any msg which client sent.

#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
[Code]....

View 1 Replies View Related

Software :: Debian Mail Server Won't Send Or Receive Mail

Apr 22, 2010

i basically had this system installed for our mail system.The setup is as follows:

1. Operating system installed is Debian ver. 5.0.3

2. Roundcube is installed as a webmail(if its right for me to say that)

3. The server is hosted right here at our offices

4.The server uses relay system to send mail i.e. relays all our mails to our ISP

That all i can say about the configurations becuase thats as much as i understand it.The problem now is that we are not able to send or recieve emails from both internal and external.I tried to send mail to a collegue in the office who is on our local LAN,Roundcube says sent successfully but the person does not recieve the mail.i tried to send to my yahoo address but nothing.I dont know where these mails have been trapped.

View 5 Replies View Related

Networking :: Broadcast Packets Failed To Receive - Socket Beginner

Feb 24, 2011

I am working on uClinux/almost same as Linux. I am new to socket programming. I have two micro controllers running on same code. Simple run with arguments mean send merged string.
run 1st micro controller (Send): ./Name "anystring"
run 2st micro controller (Recive):/Name

My code is:
int receive() {
// Create socket
int sock_fd;
struct sockaddr_in addr;
char buffer[kBufferSize];
int bytes_received=0;
int addr_len = sizeof(addr);
printf("receive start ");
sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
if ( sock_fd == -1 ) {
printf("receive Create ");
// Error occurred return 0; }
printf("Res Create sucee ");
// Create address from which we want to receive, and bind it
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons(kPortNumber);
if ( bind(sock_fd, (struct sockaddr*)&addr, sizeof(addr)) < 0 ) {
printf("receive bind "); // Error occurred return 0; }
printf("Bind Succeful sucee ");
while ( 1 ) {
// Receive a message, waiting if there's nothing there yet
bytes_received = recvfrom(sock_fd, buffer, kBufferSize-0, 0,
(struct sockaddr*)&addr, &addr_len);
if ( bytes_received < 0 ) { // Error occurred
printf("receive bytes "); return 0; }
printf(" bytes_received succeful ");
printf("Ressocketstring : %s ",buffer);
memset(Ressocketstring,0x00 , sizeof(Ressocketstring));
strcpy(buffer,Ressocketstring); printf("Ressocketstring : %s
",Ressocketstring); printf(" ");
printf("Hello Receive finished");
// Now we have bytes_received bytes of data in buffer. Print it!
fwrite(buffer, sizeof(char), bytes_received, stdout); } }
int transmit(char * data, int length) {
int sock_fds[kMaxSockets];
// Obtain list of all network interfaces
/* struct ifaddrs *addrs;
if ( getifaddrs(&addrs) < 0 ) {
// Error occurred return 0; } */
// Loop through interfaces, selecting those AF_INET devices that support broadcast, but aren't loopback or point-to-point
struct sockaddr_in addr; int number_sockets = 0; struct hostent *he;
/* const struct ifaddrs *cursor = addrs;
while ( cursor != NULL && number_sockets < kMaxSockets ) {
if ( cursor->ifa_addr->sa_family == AF_INET
&& !(cursor->ifa_flags & IFF_LOOPBACK)
&& !(cursor->ifa_flags & IFF_POINTOPOINT)
&& (cursor->ifa_flags & IFF_BROADCAST) ) {
// Create socket*/
sock_fds[number_sockets] = socket(AF_INET, SOCK_DGRAM, 0);
if ( sock_fds[number_sockets] == -1 ) // Error occurred {
printf("Error Create "); return 0; }
he = gethostbyname((char *)BCASTADDRESS) ;
if (he==NULL ) {printf("Error gethostbyname ");
herror("gethostbyname"); printf("Error host "); exit(1);
} printf("Res He ");
// Create address from which we want to send, and bind it
memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET;
addr.sin_addr = *((struct in_addr *)he->h_addr);//((struct sockaddr_in *)cursor->ifa_addr)->sin_addr; addr.sin_port = htons(kPortNumber);
if ( bind(sock_fds[number_sockets], (struct sockaddr*)&addr, sizeof(addr)) < 0 )
{ // Error occurred printf("Error bind "); return 0; }
// Enable broadcast int flag = 1;
if ( setsockopt(sock_fds[number_sockets], SOL_SOCKET, SO_BROADCAST, &flag, sizeof(flag)) != 0 ) // Err occur { printf("Error Enable "); return 0; }
number_sockets =1; printf("Succes 1 "); printf("transmit Create ");
// Initialise broadcast address memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_BROADCAST;
addr.sin_port = htons(kPortNumber);
// Send through each interface int i;
for ( i=0; i<number_sockets; i++ ) {
if ( sendto(sock_fds[i], data, length, 0, (struct sockaddr*)&addr, sizeof(addr)) < 0 )
{ printf("Error Send "); // Error occurred return 0;
} printf("Succes 2 "); } return 1; } void MergeMessage( ) {
memset(socketstring,0x00,sizeof(socketstring));
sprintf(socketstring,"%s@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s
",Tmeg.s1,Tmeg.s2,Tmeg.s3,Tmeg.s4,Tmeg.s5,Tm eg.s6,Tmeg.s7,Tmeg.s8,Tmeg.s9,Tmeg.s10,Tmeg.s11);
printf(" MergeSocketMessage : %s ",socketstring); }
int main (int argc, char** argv) {
int fd=0,bdc=0; struct ifreq ifr; printf("Tsarting man ");
fd = socket(AF_INET, SOCK_DGRAM, 0);
strncpy(ifr.ifr_name, "eth0", IFNAMSIZ-1);
ioctl(fd, SIOCGIFADDR, &ifr); close(fd);
memset(MYIP,'-',sizeof(MYIP));
memset(BCASTADDRESS,'-',sizeof(BCASTADDRESS));
strcpy(MYIP, inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
printf("Etho: %s ,len:%d ", MYIP,strlen(MYIP));
for(bdc=strlen(MYIP);MYIP[bdc-1]!='.';bdc--) {}
strncpy(BCASTADDRESS,MYIP,bdc-1); strcat(BCASTADDRESS,".255");
printf("BCASTADDRESS: %s ,len:%d
", BCASTADDRESS,strlen(BCASTADDRESS));
printf("Initial Broad Cast message "); {
/*s0"0" (id=76)
s1"500" (id=77)s2"100" (id=78)s3"100" (id=78)s4"startVD" (id=79)
s5"lighting" (id=80)s6"reading" (id=81)s7"Anna" (id=82)s8"0" (id=76)
s9"";s10"" (id=64)s11"" (id=64)*/
strcpy(Tmeg.s0,"0"); strcpy(Tmeg.s1,"500");strcpy(Tmeg.s2,"100");strcpy(Tmeg.s3,"100");
strcpy(Tmeg.s4,"startvd");strcpy(Tmeg.s5,"lighting");strcpy(Tmeg.s6,"reading");
strcpy(Tmeg.s7,"anna");strcpy(Tmeg.s8,"0"); }
MergeMessage (Tmeg); if( strlen(argv[1]) ) {
//strcpy(socketstring,Tmeg,sizeof(Tmeg));
if(transmit(socketstring, strlen(socketstring) ) ) {
printf(""%s" transmitted. ", socketstring); } else {
printf("Error occurred: %s ", strerror(errno)); return 1; } }
else { for( ; ; ) {
if ( argc < 2 ) // No argument: Just listen {
printf("Listening... "); if ( !receive() ) {
printf("Error occurred: %s ", strerror(errno)); return 1;
} return 0; } } } printf("Finished "); return 0;
} //////////////// .h file is /////////////
//#define WIN32_LEAN_AND_MEAN// Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <fcntl.h>
#include <netdb.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#define SubLen50
//#include <ifaddrs.h>
#include <errno.h>
char MYIP[20];
char BCASTADDRESS[20];
typedef struct {
char s0[SubLen];
char s1[SubLen];
char s2[SubLen];
char s3[SubLen];
char s4[SubLen];
char s5[SubLen];
char s6[SubLen];
char s7[SubLen];
char s8[SubLen];
char s9[SubLen];
char s10[SubLen];
char s11[SubLen];
}msg_struct;
msg_struct Sendmsg;
msg_struct Tmeg; //Recivemsg;
Boolean pri[6];
char socketstring[SubLen*12];
char Ressocketstring[SubLen*12];
int kBufferSize = (SubLen*12);

View 2 Replies View Related

Debian :: Can't Receive System Messages

Mar 2, 2010

I have a small LAN. I am in the process of installing a Debian Lenny/Squeeze system into the LAN. I want to send and receive system messages using rwalld and wall.I can send a system message from my Debian system to another box using rwall. I can send a local message within the Debian box using wall in a console.I cannot send a local message using wall Konsole in KDE 3.5.x. The KDE Write daemon fails to provide any pop-up window./usr/bin/wall is installed from the bsdutils package and is set to -rwxr-sr-x.

The ktalkd package is installed. The KDE control center shows a configuration option in Internet & Network settings called Local Network Chat.When not in X, mesg is set to y at the console. After starting KDE and I open Konsole, mesg is always set to n. I don't know how this setting toggles. Further, setting mesg to y in Konsole has no effect on getting wall to work.mesg is set to y when I run xterm in KDE. Then wall works within that terminal window. However, the KDE Write daemon does not see the message in xterm.When I send a message from another system to the Debian system using rwall, xterm receives the message but not Konsole or the KDE Write daemon.

When I send a wall message from Konsole, xterm receives the message but not Konsole or the KDE Write daemon.I changed TTYPERM in login.defs to 0620 to no avail.I do not have this problem on the non-Debian systems.

View 4 Replies View Related

Programming :: Socket Programming - Connect To An IRC Server In A C

Mar 16, 2010

I am looking to be able to connect to an IRC server in a C program. I have followed some instructions from an old book I have however it doesn't seem to be working. I've tried connecting to localhost on my ssh port and it still doesn't want to work. This is what I have so far as a piece of skeleton test code:

Code:
#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<unistd.h>
#include<netinet/in.h>
#include<arpa/inet.h>
[Code]....

View 1 Replies View Related

General :: Socket Programming - Feed Some Words One By One To The Socket

Jul 6, 2010

i'm writing a simple program of client socket program. Here below is the code sample which i'm writing...

Code:
//tcp_client.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include<string.h>
#include<stdlib.h>
[Code].....

the above code works fine.if we copmile and run ./a.exe 192.xx.xx.xxx 1111 and press enter it works fine..everytime it asks "Please enter the message: " and if give that will be displayed in server. but my problem is i dont want to print everytime "Please enter the message: " i just want to feed some words one by one to the socket.

View 4 Replies View Related

Programming :: Setsockopt : Socket Operation On Non-socket Getting Error?

Mar 30, 2009

im getting that error in my code for some reason. I compiled my code, and when i try to run this server it throws me an error on my call to setsocketopt(). The only way it can reach that part of my loop is if it succeeds when it calls sock() so I dont understand why the error says its an operation on a non-socket. Im just trying to set up a server to pass messages from a client to it a viceversa. Here is the code:

Code:
int main()
{
int socket_fd, new_socket_fd, k;
struct addrinfo hints, *server_info, *p;
struct sockaddr_storage peer_address;
code....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved