Networking :: Socket Programming: Sending And Receiving Msgs Back And Forth

May 19, 2010

I have a server which is used by number of client Apps. Now when a client initiates a sendto request to a server it has to respond(after recvfrom) by sending a message using sendto back to client and this should be done back and forth.

What I dont understand is, does the client have to open a new port to receive packets from client? If yes, then how will server know to what port of the client(assuming server ports are well-known to clients)?

I had given up on sending messages back and forth using UDP and switched to TCP. I could send a read and write message back and forth. But the trouble comes when I have more than one client wanting to talk to server using SOCK_STREAM. The first one gets through but the second client seems to get blocked forever(but I got no error upon socket creation or upon connect with the server on the same port as the previous client)..

View 4 Replies


ADVERTISEMENT

Programming :: Receiving The Entire Message Using TCP Socket?

Apr 15, 2010

I am trying to create a socket server in user space and a client in kernel space and send big messages (a little over 64kbytes) between them.

I used an kernel socket programming examplefrom this link - url for the kernel client side.

When the client in kernel side sends out a 64k message, usually, the server side in the user space will get a big part of the message, but will stuck at waiting for the recv() to return to get the rest of it. So I am chopping the packets into small pieces, 1000 bytes each to send to the server. But only some times, the packets will all arrive at the server/receiver side, and the server and assemble the whole message. Many times, the server is stuck at waiting for the last a couple of byte from the sending side. From the sending side printk log, it has already sent every thing.

I am attaching some log here, and the code at the end. Can someone give me some idea on how to force the data to arrive at the receiver side? Maybe the kernel on the receiver side is holding part of the packet so
the receiver program in the user space is blocked at recv()? I tried adding TCP_NODELAY on sockets on both sender and receiver sides, both it did not help.

I got a connection from (10.16.216.217 , 1489)
- Server side stuck on recv()-
bytes_recieved 17384
bytes_recieved 32768, total received 50152, expected 65540
- Client side is already done -
code....

View 2 Replies View Related

Programming :: Receiving Wrong Data On Winsock From Unix Socket

Jan 28, 2011

currently I've got a big problem on programming with sockets. I use the winsock2 API and want to receive data from a multicast adress running on a UNIX-PC. The connection works fine and I really receive data from this group, but as it seems not the right packages. The received data is saved in a char[]. E.g. at received_msg[12] is a float value. This one I would like to read out, convert and use it in later progress the next value is y at received_msg[16]. The same Code works on a Unix PC with unix sockets but converted to winsock I've got the described problem and I have to make this code work under windows.

Here a piece of the code (received_msg[12]='3f'):

Buffer is a struct containing the two float values x and y. If I convert the char as this under windows the value of x is a huge number. The correct value is around 192, so receveid_message[12] should be 1.92. Could it be that the Unix-PC is sending data in an other way than the winsock receive it?

View 2 Replies View Related

Programming :: Raw Socket Not Sending Packets?

Mar 26, 2010

(Let me first of all state that I am a newbie to any form of programming.) I have been trying to create an IP header + TCP header and send this to another machine on my network.using C)I used the normal stuff: two structures for the headers, a sockaddr_in structure, call to function socket with SOCK_RAW, setsockopt with HDRINCL and call to sendto.All functions seem to return fine (values other then -1) the function that I have used to calculate the checksum for the IPheader matches the value that I manually calculated. I just don?t see the anything coming out of the interface on whireshark.I assumed that it had something do with my piece of code so I used two examples (including mixter void ru rawip html A brief programming tutorial in C for raw sockets[/url]). They show exactly the same thing functions return fine but no packets being send.I use Ubuntu 9.04 2.6.28-14-genericThe machine has two interfaces one with an ip address the other interface is in promiscuous mode. (both interfaces connected to a switch with port mirroring) I can see all normal traffic in/out.

View 2 Replies View Related

Networking :: Sending / Receiving Between Two Systems Using IPv6 Addresses

Mar 8, 2010

We have connected two systems with ethernet cables and have configured the two systems with ipv6 addresses. The IP of one system is 2001:0db8:0:f101::1 (let's say X::1) (This system runs OS Fedora 10) and the other is 2001:0db8:0:f101::2. (Let's say X::2) (This system runs OpenSuSE 10.3) We are able to ping from both systems to the other. We are able to ssh into the one with IP X::2 from the one with IP X::1, but not vice versa.

We have disabled iptables on both systems by using the following commands:
/etc/init.d/iptables save
/etc/init.d/iptables stop
on the fedora 10 system and
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X
# iptables -P INPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -P OUTPUT ACCEPT
on the openSuse system.

The error we get in trying to ssh from the openSuse system to the fedora system is:
ssh: connect to host 2001:0db8:0:f101::1 port 22: Connection refused

We're trying to write server and client code to send data from one system to the other using SOCK_DGRAM. The code works fine when we run both the client and server on the same system. However, we are not able to send data from one system to another when we use the IPv6 addresses to run the client and server programs.

The error we get is:
sendto(): Operation not permitted

The codes we are using for the server and client programs can be found here in beej's guide here : [URL]. We've only substituted the appropriate addresses in the right places... We've disabled the iptables...

View 1 Replies View Related

Networking :: Sending / Receiving Data Simultaneously Using BSD Sockets

Jun 25, 2010

I would like to send a data using one thread and receive a data using other thread by using a same socket connection using USD sockets. The calls i am using for sending and receiving are send(), recv(). let me know is it possible to send and receive the data parallel (Full duplex communication)?

View 2 Replies View Related

Server :: Postfix Don't Sending / Receiving Anything?

Nov 8, 2010

Yesterday i run a postfix everything works fine and today it hangs up. if i dial "telnet localhost 25" i get (before day i get 220 answer and ordinary hello):

Code:
Trying 62.197.207.43...
Connected to trons.sk.
Escape character is '^]'.
and nothing go far.

[Code]....

View 2 Replies View Related

General :: Trouble In Sending And Receiving Email

Nov 23, 2009

i have a problem regarding our email server. all the users can send email but they cant received mail. .when hitting send receive on outlook there were no error found. .i have already reboot the server and restarted the sendmail services but still same problem.

View 1 Replies View Related

Server :: Dovecot Mailserver Sending But Not Receiving?

Jan 22, 2011

I have followed the guide for "The Perfect Server - Debian Lenny (Debian 5.0) With BIND & Dovecot [ISPConfig 3]" and all is well, except.

I can send mail (to GMail) from commandline. I can send mail (to GMail) from any of the domains configured in ISPConfig3 through SquirrelMail (how ever terrible that looks, but functions) or IMAP/POP.

but....

I can't receive mail (from GMail) on any of the domains configured in ISPConfig3 in SquirrelMail or IMAP/POP.

I have my domains configured with proper MX records (just like I have them configured at work). I have all ports (80, 143, 110, 25, 22, etc) forwarded on my router that are needed.

I can Telnet to localhost and all checks are fine. I can send and receive from and to local domains on the same server, which makes sense. but

I can't Telnet from any external server to my server behind NAT.

Conclusion:

I figured it MUST be a network/port-forwarding problem as the external Telnet requests fails to my machine on port 25.

Tested my router if it would let met communicate through port 25 and it would.

So it must be my ISP, as I read in different posts.

Question:

Maybe I'm a n00b, but in all other posts the problems were with receiving AND sending.

My ISP responded that port 25 is blocked because of spam issues.

But I can mail (and even spam if I would like to) to external domains while I didn't do anything weird to make that happen.

The only thing I wish for is to receive mails and if you'd ask me, port 25 would be solely for outgoing mails, not for incoming mail deliveries throught MX?

An ISP surely wouldn't disable their customers in having a mail-server for incoming mails, as long as they would send out through their own smtp server to make sure they wouldn't spam the world?

View 1 Replies View Related

Server :: Block Email Sending And Receiving Using Squid

Jun 17, 2010

i am using centos 5.4, running squid for proxy, i want to block email sending and receiving of proxy users to secure my data. how is it possible that the proxy user can only brows websites but he can not receive or open and send or save as draft to mail box.

View 1 Replies View Related

Server :: Postfix Is For Sending/receiving Internal Emails Only?

Jan 21, 2010

One of our postfix servers is for sending/receiving internal emails only. When a user entered a wrong recipient address, it will take almost an hour for the user to get the "Recipient address rejected" email. What can be done to let the user get the "Recipient address rejected" email quickier.

View 7 Replies View Related

Fedora :: Finding Out What Processes Sending / Receiving Network Data?

Oct 27, 2010

I have a desklet that, occasionally after toying with network stuff, will tell me that large amounts of data are being sent/received. What's a good way to determine what processes are occupying these resources?!

View 14 Replies View Related

Ubuntu Installation :: Software For Sending / Receiving SMS From Huawei Modem

Feb 12, 2011

I'm using Huawei E1550 3G modem. Any tool so that I can send and receive sms, even USSD also...

View 1 Replies View Related

Server :: Sendmail Block Sending Or Receiving .exe Files As Attachment

Jun 22, 2010

Please tell me how i can block sending or receiving .exe files as a attachment in sendmail server

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

Software :: Look For Free And Well Known Fax Command Line Tools For Receiving And Sending Faxes?

Apr 19, 2011

I am looking for free and well known fax command line tools for receiving and sending faxes I wan it to save receive faxes in pdf format with file name included with caller phone number and date of receive:

Quote:
for example:
5566545544-2011-5-11.pdf
and any other format that I want.

View 11 Replies View Related

Ubuntu :: Internet Conection - Transfer Rate - When Active - Is About 149b/s Receiving - And About 70b/s Sending

Apr 6, 2011

I checked task manager the other day and I discovered that on the network history monitor some bits and bites were transfered in a repeating pattern (like a beacon). The transfer rate (when active) is about 149b/s receiving. And about 70b/s sending. What is this?

No Internet-related program was running from my part...In an attempt to pinpoint what was causing this, I occidentally removed the tools located left and right on the time and date. I've rebooted since but still no tools. The 0/I button is also gone.

View 5 Replies View Related

General :: By Default - Configure SMTP And POP3/IMAP Sever For Sending And Receiving Mails ?

Mar 30, 2010

I want to know that by default do we need to configure SMTP and POP3/IMAP sever for sending and receiving mails in Linux server and client machines or we can directly send and receive mails without configuring these mail servers?

View 2 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

Networking :: Socket Programming - Connect To Port Y On IP X With Telnet

Sep 16, 2010

I have a customer who is complaining that they can connect to prt y on IP x with telnet. They are seeing the following:

telnet x.x.x.x y
Trying x.x.x.x...
Connected to x.x.x.x.
Escape character is '^]'.

after some time the connection of course times out. Connection closed by foreign host. There is no telnet service running on this port so they cannot do anything, but they are complaining tht the fact that telnet "connects" is a security risk. I am having difficulty explaining why they are able to connect with telnet. I know it has to do with the socket layer API in Linux but I am having difficulty explaining this sufficiently. I also can't just say "this is the way linux works" to them. I am looking through "UNIX Network Programming" by W.

View 3 Replies View Related

Networking :: Remote Access Using Socket Programming - Open A Cmd.exe

Dec 16, 2010

i want to open a cmd.exe of a remote machine in my own machine.. i am using c language. its just for educational purpose.

View 9 Replies View Related

Networking :: Configuring Socket Timer To Release Socket Once The Connection Is Terminated?

Jun 4, 2010

I want to configure socket timer to release socket(port) once the connection is terminated. Do we have something in Linux OS to configure this delay to release socket?.

Any command, link or man-page anything will be helpful.

I browsed a lot but unable to find it.

View 1 Replies View Related

Networking :: /usr/sbin/in.telnetd: Getpeername: Socket Operation On Non-socket?

May 5, 2009

I had installed Fedora 10

Below is the output of uname -a

Linux 2.6.27.5-117.fc10.i686.PAE #1 SMP Tue Nov 18 12:08:10 EST 2008 i686 i686 i386 GNU/Linux

I need to enable telnet service on it, then found xinetd and telnet-server not installed,

Then I had installed below
First I had installed Xinetd: xinetd-2.3.14-21.fc10.i386.rpm
then I had installed telnet-server: xinetd-2.3.14-21.fc10.i386.rpm

After installation I executed below commands

Service xinetd start
Chkconfig xinetd on
Chkconfig telnet on
Service iptables stop
Chkconfig iptables off
Iptables �F

After I had tried telnet localhost ----IT FAILED

when I run telnet server manually by issuing the below command
/usr/sbin/in.telnetd, I get below error
[COLOR="Red"]/usr/sbin/in.telnetd: getpeername: Socket operation on non-socket[/COLOR]

I have other system running same OS, I had followed the same steps discussed above to enable telnet, It works fine on it.

View 1 Replies View Related

Ubuntu Networking :: Bluetooth - SPP Mode / Listen (and Also Send) To Serial Comm Msgs On Bluetooth?

Jun 25, 2010

i have a bluetooth modem (BlueSMiRF) that is connected to Arduino Duemilanove. I am trying to see serial communication messages from the bluetooth modem.

I have Blueman Device Manager that enabled SPP (Serial Port) and it says :

Code:
Serial port connected to /dev/rfcomm0
How do I see the serial communication on this?

I tried on console

Code:
$rfcomm listen 0
but it's stuck at
Code:
Waiting for connection on Channel 1
Is there any other way to listen (and also send) to serial comm msgs on bluetooth?

View 1 Replies View Related

Networking :: Multiple FTP Upload Socket Error "Connection Reset By Peer: Socket Write"

Jan 31, 2010

I am pragmatically trying to upload a list of files from my client machine to a proFTPd server I have running on Ubuntu. Every time I get several (around fifty) files into the transfer, I get the following error: Quote: Connection reset by peer: socket write error

I am able to remotely upload 25,000 small files of ~ 1K in size, but when I go to upload hundreds of 2-4 Mb files, I get a socket write error. Am I using up all available sockets before they can be released? If so, how do I release the sockets? If not, what does this error mean and why am I getting it?

View 1 Replies View Related

Programming :: Timer In Socket Programming - Wait For X Sec After Read() And Then Disconnect The Client Connection

Mar 8, 2011

I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.

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

Programming :: Socket Programming While Displaying Received Message In File

May 11, 2011

i have problem in socket programming, while displaying received message in file,i got a problem... i cant able to write it in the file.... this is the code....

Code:
/* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
[Code]....

now my problem is run time error i can able to create file but i cant able to write file....log.txt contain nothing.... as here i have give sample code... dont say not initialising function and all.... i have initialised , please only see func1() - my problem is only not able to write msg which i got received from the client..

View 2 Replies View Related

Programming :: Use Socket Programming In Order To Implement Chatting Feature?

Aug 25, 2010

how to use socket programming in order to implement chatting feature

View 5 Replies View Related







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