|
What I'm working on is basically creating a new version of an old server program. The server service receives messages from an oracle database and distributes those messages to all the connected users, a bit like a chat program that only the administrator can talk on. (It's used to inform the client programs when something has changed in the DB so they can always display the most current data.)
Well, we need the new server to handle a whole new type of client that's running on .NET 3.5, but also be backward compatible with the old C++ client.
So the point I'm getting to here is that the system uses named pipes to communicate from server to clients. The way it was designed back in the day (long before I got involved!) had the server calling CreateNamedPipe to open \\.\pipe\serverrouter, and then the clients connected to it by calling CreateFile with \\<server computer>\pipe\serverrouter as an argument.
I've created a server that creates a NamedPipeServerStream and a client that can connect to it, but the old style client can't see that stream at all -- like it doesn't even exist.
As a smaller-scale test I created a new VB.net application and gave it one command:
Dim test As New System.IO.FileStream("\\<server computer>\pipe\serverrouter", IO.FileMode.OpenOrCreate)
Now, here's what brings up my question: If I point that at the computer that's running the old style server, it throws an exception saying "Filestream was asked to open a device that was not a file..." Which is all well and good, I get that -- but when I point it at the computer running the new server program, the exception is "Could not find file". This matches the behavior of the old style client.
What's going on here? Why can't I find the pipe with anything other than a NamedPipeClientStream? A pipe is a pipe, isn't it? How do I get it to at least see the thing? (Actually achieving a connection would be nice too, but I'll settle for being able to see it on the network first!)
|
|
|
|
|
LurkingGryphon wrote: but also be backward compatible with the old C++ client.
Somebody really does not like you. Going down this path is one of the reasons Crystal Reports is such a dog, the reason MS rebuilt some of their tools and completely broke backwards compatibility. I have the feeling that a lot of .net stuff is only consumable by .net. You could try wrapping it as com visible and see if that helps (probably not)
I'd seriously look at the design and the need for backwards compatibility.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I got it figured out finally.
It's a naming convention issue: in the old style named pipe calls (which are in kernel32, I believe), you have to specify the full path: \\.\pipe\pipename (and the users connect to \\servername\pipe\pipename)
But in .net, you only specify the "pipename" part. It automatically prepends the "\\.\pipe" internally on the server pipe, and the client pipe's New takes either a computer name argument or not (in which case it presumes the pipe is local), and prepends either "\\computername\pipe\" or "\\.\pipe\" as appropriate.
So if you use the old style address specification with the .net NamedPipeServerStream constructor, it actually ends up putting your pipe at \\.\pipe\pipe\pipename! That's fine if the other end is a NamedPipeClientStream, which will do the same manipulation and not cause a problem, but if you try to create a stream with one and connect with the other, one of them will be looking in \pipe\pipe\ and be unable to find it.
Judging from the examples I've seen of how to use .net's named pipe classes, this is a very common error.
|
|
|
|
|
Put i a tip & trick, make sure there are the right key word and save it for posterity, or some other poor bugger running up against it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
We have a pair of programs using named pipes with a .NET server app and a native (Delphi, not C++, but still native) client app, so I know this is possible. During development, the programs ran on different machines and the required step to let the programs talk across different users was to use the NamedPipeServerStream overload that took a PipeSecurity. It ended up something like this (namespaces avoided for brevity):
Dim ps As PipeSecurity
ps.AddAccessRule(New PipeAccessRule("Everyone", PipeAccessRights.FullControl,
AccessControlType.Allow))
Dim New NamedPipeServerStream("PipeName", ..., ps)
As I recall, the problem was configuring the security of the pipe to allow users from another computer to connect.
|
|
|
|
|
I did add that code; it didn't fix anything by itself, but once I got the naming convention straightened out (see previous post) everything worked correctly. I don't know if that security specification was really needed, but the thing works with it in, so thanks for posting it.
|
|
|
|
|
Hi all,
Please tel me how to bind a listview using dataset in vb.net application?
Thnaks in advance
|
|
|
|
|
Dim ImageList16 As New ImageList,DAp1 as SqlDataAdapter,Ds1 as New DataSet
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\party_fig.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_spcl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\target.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_dtl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_dtl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\indent_fig.gif"))
ListView1.Items.Clear()
ListView1.Refresh()
ListView1.View = View.Details
ListView1.BorderStyle = BorderStyle.FixedSingle
ListView1.BackColor = Color.Azure
ListView1.ForeColor = Color.Green
ListView1.HoverSelection = True
ListView1.FullRowSelect = True
ListView1.HeaderStyle = ColumnHeaderStyle.Nonclickable
ListView1.GridLines = True
ListView1.Cursor = Cursors.Hand
ListView1.Columns.Add("MT No", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("MT DATE", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("ITEM_DESCRIPTION", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("ITEM_CODE", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("TRANSFER Qty", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("UNIT", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("PROJECT", -2, HorizontalAlignment.Left)
ListView1.SmallImageList = ImageList16
ListView1.Columns(0).ImageIndex = 0
ListView1.Columns(1).ImageIndex = 1
ListView1.Columns(2).ImageIndex = 2
ListView1.Columns(3).ImageIndex = 3
ListView1.Columns(4).ImageIndex = 4
ListView1.Columns(4).ImageIndex = 5
ListView1.Columns(4).ImageIndex = 6
ListView1.Font = New System.Drawing.Font("Times New Roman", 8, FontStyle.Regular, GraphicsUnit.Point, Byte.MinValue)
Private Sub ComboBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Click
Ds1.Clear()
ComboBox1.DroppedDown = True
con.ConnectionString = ConStr_2
con.Open()
DAp1 = New SqlDataAdapter(Query1, con)
DAp1.Fill(Ds1)
con.Close()
ListView1.Items.Clear()
ListView1.Refresh()
For A3 As Integer = 0 To Ds1.Tables(0).Rows.Count - 1
Dim RItem As ListViewItem
RItem = New ListViewItem(Ds1.Tables(0).Rows(A3).Item("mt_no").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("mt_date").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_description").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_code").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("tran_qty").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_units").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("proj_name").ToString)
ListView1.Items.Add(RItem)
Next
ListView1.Visible = True
ListView1.Focus()
End Sub
|
|
|
|
|
|
Hi,
i hope this can be answered in this Message Board.
I have some VBA code in Access 2007 that opens up a table in Print Preview mode. I want the orientation to be in landscape.
Here is the code that puts it in Print Preview mode:
Dim prtPrintPreview As Printer 'trying this to no avail
stDocName = "MyDataTable"
DoCmd.OpenTable stDocName, acViewPreview
Set prtPrintPreview = Application.Printers(0) 'this did nothing
prtPrintPreview.Orientation = acPRORLandscape
When the table opens, it is put in Print Preview (this is the only Access2007 menu tab available).
|
|
|
|
|
Hi,
You can change the default orientation like this[^];
Application.Printer.Orientation = acPRORLandscape
stDocName = "SomeTableName"
DoCmd.OpenTable stDocName, acViewPreview
I are Troll
|
|
|
|
|
THANK YOU!
I was looking all over the Net and MSDN for about 2 hours (and even contracted a suspicious "file") in the process.
This did exactly what i needed.
Thanks again,
John JM
|
|
|
|
|
Can I raise my own compilation error.
For example if an object gets used before a property is set can I raise that as an error when we compile?
Humble Programmer
|
|
|
|
|
programmervb.netc++ wrote: Can I raise my own compilation error.
That would be easy in C#;
#warning "You've been warned!"
#error "about a warning and an error"
Alas, VB.NET doesn't seem to have an equivalent. The closest match would be misusing the Obsolete -attribute;
<Obsolete("Danger, Will Robinson!", True)> _
Sub Test()
End Sub
I are Troll
|
|
|
|
|
LOL @ Danger, Will Robinson!
Ahhhh can I have your address to send you the dry cleaning bill? Coffee stains and whatnot.
|
|
|
|
|
Lost in Space was a very long time ago.. Coffee stains?
I are Troll
|
|
|
|
|
When we connect to live data and are in the dev environment it shows big message that says ERROR ERROR WILL ROBINSON YOU ARE IN LIVE DATA!!!!
Humble Programmer
|
|
|
|
|
Hehe, cool ![Cool | :cool:](https://www.codeproject.com/script/Forums/Images/smiley_cool.gif)
|
|
|
|
|
Hi,
Tooltip is not one of the properties for image. I need to show a text when I mouseover an image.
thanks a lot in advance
|
|
|
|
|
You might be displaying the image in the PictureBox or some other control. So, create a tooltip object and use its SetToolTip method.
|
|
|
|
|
Hi,
Thanks. I have the image in a picturebox, when I click,it does something.
when I mouseover the image I want to display a text for example ADD..
I drop a tooltip control onto the form...I tried some few codes, no luck.
Can you guide me?
Thanks again..
|
|
|
|
|
As soon as you drop a tooltip on the form, the picturebox gets the property "Tooltip on ToolTip1" (or whatever name you gave the new tooltip). Put your text in here.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
|
Having added a Tooltip control to your form (as has been suggested already) you can also set the tool tip programatically by passing the control and the text to display to the Tooltip control. eg.
me.toolTip1.SetToolTip(me.PictureBox1, "Whatever")
|
|
|
|
|