LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 07-19-2012, 03:04 AM   #1
bhatravithegr8
LQ Newbie
 
Registered: Jul 2012
Posts: 2

Rep: Reputation: 0
Not able to connect to Ubuntu VBox through socket from Windows!


Hi, I have a server(C code) running on Linux-Ubuntu with below settings:
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(5000);
server_addr.sin_addr.s_addr = INADDR_ANY;


And I am trying to send messages to this server from a Python script on Windows. And I am not able to do this successfully. But if I run the same Python script from Linux-Ubuntu, it is able to communicate. Please help me guys. I tried changing my Network Adapter settings from NAT to Bridged. But no success. Please help!

Python code:
import socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while 1:
data = raw_input( "SEND: TYPE q or Q to Quit:" )
if( data <> 'q' and data <> 'Q' ):
client_socket.sendto(data,("localhost",5000))

client_socket.recvfrom( 1024 )
print "RECIEVED:" , data
else:
client_socket.sendto( data, ("localhost",5000) )
break;
client_socket.close()
 
Old 07-19-2012, 05:35 PM   #2
MCD555
Member
 
Registered: May 2009
Location: Milan, Italy
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109

Rep: Reputation: 10
Have you export the socket listen port on your VBox settings?
I mean, from the Settings panel of you Ubuntu you need to:

- select Network tab
- click on Advanced
- and once there on Port forwarding: now you have to compile the form with the port to forward

All these steps must be performed with the virtual machine switched off.

Hope this helps!
 
1 members found this post helpful.
Old 07-20-2012, 01:20 AM   #3
bhatravithegr8
LQ Newbie
 
Registered: Jul 2012
Posts: 2

Original Poster
Rep: Reputation: 0
Talking

YES!! It is working now.. Thanks a lot man.. I love you
 
Old 07-20-2012, 06:49 AM   #4
MCD555
Member
 
Registered: May 2009
Location: Milan, Italy
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109

Rep: Reputation: 10
You're welcome!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu won't let Windows XP machine connect to ubuntu shared folder. rjs1943 Linux - Wireless Networking 6 06-19-2011 04:23 PM
[SOLVED] vbox 4.0.2 - guest sabayon5.4 on win7 - mnt local gentoo from vbox sabayon? shinystuffrox Linux - Virtualization and Cloud 1 03-04-2011 01:10 AM
Can't connect to UNIX socket /var/run/clamav/clamd.socket ganick Linux - Server 8 08-01-2008 01:22 PM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
connect: socket operation on non-socket bit7 Linux - Networking 0 02-18-2003 05:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration