How are those "files" of type "socket", whose name
begins with "=", created? How can I create them with
python?
Thanks. 8 3192
On Fri, Aug 20, 2004 at 09:58:43PM +0100, Paulo da Silva wrote: How are those "files" of type "socket", whose name begins with "=", created? How can I create them with python?
they don't start w/ =; that's just ls being verbose. try 'ls -1'.
you can create them with os.mkfifo. see lib doc, section 6.1.4.
Marcos Dione wrote: On Fri, Aug 20, 2004 at 09:58:43PM +0100, Paulo da Silva wrote:
How are those "files" of type "socket", whose name begins with "=", created? How can I create them with python?
they don't start w/ =; that's just ls being verbose. try 'ls -1'.
you can create them with os.mkfifo. see lib doc, section 6.1.4.
mkfifo creates fifo nodes, not "socket"-type files.
I think Unix domain sockets are what the OP means...
Which are created by using the AF_UNIX socket type:
from socket import *
sock=socket(AF_ UNIX,SOCK_STREA M)
sock.bind("/tmp/mysocket")
BTW, my ls lists them in pink, with a '=' at *the end*.
That's on Mandrake 10.
--Irmen
Marcos Dione wrote:
.... they don't start w/ =; that's just ls being verbose. try 'ls -1'.
you can create them with os.mkfifo. see lib doc, section 6.1.4.
This seems to work. At least ls gives the same result.
Thank you.
Irmen de Jong wrote: Marcos Dione wrote:
.... mkfifo creates fifo nodes, not "socket"-type files. I think Unix domain sockets are what the OP means... Which are created by using the AF_UNIX socket type:
from socket import * sock=socket(AF_ UNIX,SOCK_STREA M) sock.bind("/tmp/mysocket")
....
This seems more logical. Besides there is also a "file" type
"fifo" where I was using mkfifo.
I'll give it a try. Unfortunately I began to upgrade my Gentoo
Linux and I am busy now.
Thank you.
Paulo da Silva wrote: Irmen de Jong wrote:
Marcos Dione wrote: ...
....
from socket import * sock=socket(AF_ UNIX,SOCK_STREA M) sock.bind("/tmp/mysocket")
... This seems more logical. Besides there is also a "file" type "fifo" where I was using mkfifo.
I'll give it a try. Unfortunately I began to upgrade my Gentoo Linux and I am busy now.
OK. It works! I'll use mkfifo for "fifo" type and this for
"socket" type.
BTW, don't I need to close "sock.close ()"? I don't want to
do anything with the socket except keeping it on disk.
Paulo da Silva <ps*********@es otericax.ptx> wrote: Irmen de Jong wrote: from socket import * sock=socket(AF_ UNIX,SOCK_STREA M) sock.bind("/tmp/mysocket") [...]
OK. It works! I'll use mkfifo for "fifo" type and this for "socket" type. BTW, don't I need to close "sock.close ()"? I don't want to do anything with the socket except keeping it on disk.
Uhm, are you sure you know what you're doing? UNIX domain
sockets work very similar to Internet domain sockets, i.e.
they disappear when they're closed (or when your program
exits, in which case everything is closed implicitly).
Why exactly do you want to create one and keep it on disk
without doing anything with it? That doesn't seem make any
sense at all.
Best regards
Oliver
--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany
``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
Oliver Fromme wrote: Paulo da Silva <ps*********@es otericax.ptx> wrote:
....
Why exactly do you want to create one and keep it on disk without doing anything with it? That doesn't seem make any sense at all.
Well, I never programmed anything using fifo or sockets.
What I need to do as part of a work is to get information
about some disk or a dir contents and then replicate it
later (something like a backup). I don't really know if
those "files" of type socket have any other role behind
sockets communication. So I thought of replicate them also.
I have seen that tar doesn't seem to "save" them, but cp does.
BTW, those "files" are kept after issuing close().
Thank you for your comments on this.
Oliver Fromme wrote: Uhm, are you sure you know what you're doing? UNIX domain sockets work very similar to Internet domain sockets, i.e. they disappear when they're closed (or when your program exits, in which case everything is closed implicitly).
Indeed. Last time I played with Unix-domain sockets (which
was quite some time ago, things may have changed since)
the entry in the file system seemed to be completely
useless -- you couldn't do anything with it that you
might expect, e.g. open() it. The docs described the fact
that a file system entry existed as a "side effect" that
might go away in future versions.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Greg Bryant |
last post by:
I'm doing some work for a company that has an auction site running in
coldfusion. They're not real happy with it, and it needs a major overhaul,
so I'm looking at redoing it, and while I'm at it, might as well move to
PHP (for a variety of reasons - not trying to reopen the PHP -vs- CFM thing
again :).
Anyway, so I'm looking at this system, and there are no "scheduled tasks"
(it's win2kas). How do you write a server app that needs to...
|
by: David Konerding |
last post by:
Hello,
I have written an app which opens a TCP connection to a server and uses a protocol to communicate with it.
Specifically, I've written a python IMD client for the molecular dynamics application 'NAMD' (do searches for IMD and NAMD if you want to learn more).
The protocol is very simple: both ends of the TCP connection can send messages to the other side at any time; when data is
available on a read socket, a full packet (with known...
|
by: Kamus of Kadizhar |
last post by:
I have the following function which generates MD5 hashes for files on a
local and remote server. The remote server has a little applet that
runs from inetd and generates an MD5 hash given the file name.
The problem is that it takes 2+ minutes to generate the MD5 hash, so
this function takes about 5 minutes every time it is called. Since the
first MD5 hash is generated on a remote machine, the local machine does
nothing but wait for...
|
by: mike |
last post by:
regards:
I use Jtidy (api) to translate a HTML file into a "XHTML file".
But The "XHTML file" cannot be identified by nokia 6600.
Do I miss something important?
Or this is Jtidy's weakness or bug?
Can someone excellent to tell me the reason.
best wishes
|
by: akbarhome |
last post by:
Hi,
I am following this tutorial
https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=dw-linux-pysocks&S_TACT=105AGX59&S_CMP=GR&ca=dgr-lnxw07PythonSockets
( free reg. req. )
The article told me to do this:
$ python
Python 2.4 (#1, Feb 20 2005, 11:25:45)
| |
by: Grant Richard |
last post by:
Using the TcpListener and TcpClient I created a program that just sends and
receives a short string - over and over again. The program is fine until it
gets to around 1500 to 1800 messages. At that time, I get a SocketException
with the message "Only one usage of each socket address (protocol/network
address/port) is normally permitted". This happen if you use localhost or
between two distinct computers. And, for a period of time after the...
|
by: Dr. J |
last post by:
I have an application that opens a socket and connects to another
application listening over a port. The problem I am encountering is that
when the listening application is closed my application cannot detect it to
take appropriate action. I am using "Connected" property of the Socket
class, but it seems this property does not reflect the true state of the
socket connection.
Here is the code snippet. Basically, I am checking the...
|
by: Sherry |
last post by:
We are using the sample code "AsynchronousClient" from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconnon-blockingclientsocketexample.asp.
It works for the wired (ethernet) connection. While the laptop is in wireless
environment, the laptop get exception:
"System.Net.Sockets.SocketException: No connection could be made because
the target machine actively refused it
at...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |