Networking :: Bad: Two Sockets Of Different Ports In A Single Program?
Mar 4, 2011
I am trying to make a file proxy server...that is any request of file a client makes goes to the proxy server...it checks it in cache if not there then asks main server for the file. to act as a server for client and as client for server...how to do it in a single program. I tried with 2sockets with different ports one for client-proxy server and one for proxyserver-main server.But it does not workAm i doing something wrong or is there any other method
I have question about the UNIX sockets. my goal is to connect multiple sockets from a single client to a single server and keep them open...I'm not sure if that is possible to create or not. Do you have any suggestion or an example of code?
I need to create a C/C++ program in Linux that succeeds in detecting how many tcp-sockets and what tcp-sockets are created by the other processes in the system in a particular time interval (e.g., the interval time this application is running in). Then, I'd need to get some information like local/remote port number and local/remote ip address of each of these sockets.
I am trying to write a chat program with sockets as part of my project. I made a socket server, using fork ,I tried to connect it with different clients.Each client will send messages to others through server.So server has a shared memory storing every clients username and client id. But the problem facing is first client is able to sent messages to every other client formed after that.But second client onwards it is not able to sent message to previously connected ones. Server is not able to write on those client id's.
I am trying to write to the parallel port pins from a Perl program running Ubuntu Linux, to light up led's on a bread board. I've already accomplished this on this same box using a C program, but I cannot get my code below to work. I believe the problem is with the line: $parport = Device::ParallelPort->new('auto:0'); I've tried different variables between the ('') ticks, but nothing has worked. I use Perl on my web pages for forms, but this has stumped me.
Code is below: #!/usr/bin/perl require "subparseform.lib"; &Parse_Form; print "Set-cookie: cart_id=1234; user_id=123; "; print "Content-type: text/html "; use strict; use CGI; use Device::ParallelPort; # use Device::ParallelPort::drv; # use Device::ParallelPort::drv::linux # use Device::ParallelPort::drv::parport # Set up your parallel port object and tell it what driver to use. #my $parport = Device::ParallelPort->new('auto:0'); print "It works!!!";
I created a socket.port no 21 meaning ftp client. I am sending some stings and receviing some data from server.Fine.
But I want to send a file some x.c to host using socket. Please can someone help me whether we can do it or not. If we can how can we send a file.I was only able to send buffer and data but not a file.Please if possible can you help me with example.
The problem started when I noticed I couldn't upload to people using a torrent downloading program, the program listened on port X and when I sniffed on the same port I saw that syn's are forwarded correctly from my nat to that port but the program doesn't relate to those packets. Then I listened with NC, and even on another port nothing is being answered to those syns packets.
root@HOST [~]# /etc/init.d/httpd start Starting httpd: no listening sockets available, shutting down Unable to open log [FAILED] root@HOST [~]# /etc/init.d/httpd restart Stopping httpd: [FAILED] Starting httpd: no listening sockets available, shutting down Unable to open logs [FAILED] root@HOST [~]# tail -n 10 /var/log/messages Sep 29 17:59:30 localhost avahi-daemon: New relevant interface wlan0.IPv4 for mDNS. Sep 29 17:59:30 localhost avahi-daemon: Joining mDNS multicast group on interface wlan0.IPv4 with address 220.127.116.11. Sep 29 17:59:30 localhost avahi-daemon: Registering new address record for 18.104.22.168 on wlan0. Sep 29 17:59:31 localhost avahi-daemon: New relevant interface wlan0.IPv6 for mDNS. Sep 29 17:59:31 localhost avahi-daemon: Joining mDNS multicast group on interface wlan0.IPv6 with address fe80::223:cdff:fecb:9c5e. Sep 29 17:59:31 localhost avahi-daemon: Registering new address record for fe80::223:cdff:fecb:9c5e on wlan0. Sep 29 17:59:31 localhost NetworkManager: <info> (wlan0): device state change: 7 -> 8 Sep 29 17:59:31 localhost NetworkManager: <info> Policy set 'Sunsoft1' (wlan0) as default for routing and DNS. Sep 29 17:59:31 localhost NetworkManager: <info> Activation (wlan0) successful, device activated. Sep 29 17:59:31 localhost NetworkManager: <info> Activation (wlan0) Stage 5 of 5 (IP Configure Commit) complete. What is the problem I have a local server CentOS Linux
Running Ubuntu and writing simple C programs. I need 2 text windows, the one I have started in, and a second to display some debug information. I can start a second screen using popen("/usr/X11R6/bin/xterm" "w"), and I get my new text window. However, it is running a shell and I can't send any info to it!
I wrote an application that receives packets on one interface and sends them to another interface after it added a vlan header. Both the sending and the receiving is done using raw sockets. Everything seems to work fine until I get TCP packets that are of size 1514 (MTU). Once I add a vlan header to the packet, its size becomes 1518 and when I try to send it I get the returned value -1 and errno=90 (message too long). I tried to change the MTU of the NIC to a value that is bigger than 1500 but that fails. If I create a bridge using brctl and vconfig between the NICs I can see that my NIC does sends packets of size 1518. What do I need to in order to make my NIC to send packets of size 1518?
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)?
I have downloaded the jdk-6u20-linux-i586.bin from their website. I also read the instruction given to install jdk manually but i was not able to run a single program. Can someone give a step by step instruction to install jdk and also tell me how to set the path so i can easily execute the programs.
I am writing a code in Python where a socket client changes data with the server. That works nice if the connection is up. However it is also supposed to work offline. So I need to be able to detect if the connection is up before sending data, but I was not able to do so. A summary of the code is like that:
if connected: data = "some data byte" try: socket.send(data) except: connected=False socket.close()
If I unplug the cable after the connection is ready then the socket sends data and does not detect the connection failure. What is amazing is that the client detects the connection failure just after the cable has been plugged again. Of course there is a loop in the code above and always that connected==False a new connection is made. How could the program detect the connection failure before sending data and then lead the code to an exception?
I am learning about net filters and I am practicing some sample programs on it. I am very new to this and I have a general query. I got the packet to a desired function using PRE_ROUTING hook. Now how do I frame a packet from this point? I am just trying to simulate a echo client server program in the kernel level using these hooks. Any useful info on sockets in the kernel level?
I've looked, but no luck. Coming from Debian, 5.02, is there a setting in Ubuntu 10.10 that will allow me to single click to open a folder/launch a program. I don't mean the one i am using now that is set up with the mouse setting where it seems to be an assistive technologies application where there is a slider to set the dwell time (when i use this one, i get a menu opening at the same time as the application launch), but the one where the pointer turns to a little hand when it moves over the icon, and opens/launches the program when the button is released.
I have ubuntu 11.04 installed along side windows. And I often share files with windows computers. If I am installing a new package from ubuntu software center, and consquently I have to log in as root to do so, which means I have given the system 'privileges' as the program is being installed, I decide to go open mozilla, and surf suspicious sites on the net. Is it possible in that case for me to get a virus?
When we enter the password for the root user in order to run one program such as ubuntu software center, does that mean that all programs have root privileges for the time being (as the software center is installing the program)?
For monitoring a network [LAN] I need a single C/C++ program using unix commands to retrieve the username, associated static IP address, what time user logged in, log out, total time system used by user. so that if a system has several users who used it @ different times of the day... then i need details of all users me,time of log in, static IP &all
I've been trying to find a way to take a bunch of jpeg images and while maintaining their quality (no loss at all) compile them in such a way as to make one coherent file. Maybe something like a pdf, but while maintaining quality. I've tried converting to pdf and djvu, but the quality is always reduced, but if you know of a way to preserve quality, I'll use it.An alternative is an image viewer that can look inside archives, so I just make a zip or tgz of the images and then use the image viewer to access them. I've tried a few
I'm writting an app for desktop and embedded linux and I need to get information about the multiserial port, and I need to know which port is been used (by a printer, por example).The multiserial I'm using is an Altera Corporation Device 0004, and I just need to tell how many ports are there and how many is been used.
A few months ago I installed Ubuntu 9.10 on my girlfriends laptop, on her request, as she didn't like Windows any more. Since then the internet connection periodically slows down due to too many open ports/connections. Always when this happens I call our ISP and usually there are around 80-200(!) active connections to various IP's.
She is not downloading torrents or anything. She only uses Firefox and a few open tabs as people do. Skype is open. Wireless internet connection.
I am thinking either Ubuntu is updating more or less constantly or the ports/connections aren't closed "after use".