|
Hi all.
I am new to socket programming .i have two application created on .net 2 version and this two application is listening to single port .
First application sends the data and second application recieves the data.
Now i am getting following error
Only one usage of each socket address (protocol/network address/port)
is normally permitted
Can any pls help
Thanks in Advance
Regards
DilipRam
|
|
|
|
|
One of your applications, or some other app, is already using whatever port you picked. You didn't say which app is throwing the exception or what is was doing at the time of the error.
|
|
|
|
|
Sorry for not mentioning it clearly.My first application opens a connection at the formload event and then access the send message method which is written in the class file.My second application also opens a connection in its form load event and access recieve method which is written in the class file.Both application are accessing same port.when i load the first application , the first application shows the error.
Hope i am clear this time.
Regards
DilipRam
|
|
|
|
|
You've got both application opening the same port. That won't work.
The first application will launch and open the port. The second will fail every time because you can't have two applications listening on the same port.
Now, if you launch the first application and it fails, then some other application already has the port open, or, the port was never closed and released properly on the first run of your app.
|
|
|
|
|
Thanks for the reply.But then if i want a application which should send some data and another application should recieve that same data, and after recieving data , the recieved application should send the data back to send application, then how can i do it.Should i use different ports.If i use different ports then how can each application recieve the data.Can you pls explain it.
Regards
DilipRam
|
|
|
|
|
They talk back and forth on the same port. The server listens on a port, the client connects to the server on that port, then, in a simple example, they both use NetworkStreams to talk back and forth to each other, just like reading/writing a text file.
If you want examples, Google for "C# Chat" and you'll come up with tons of them.
|
|
|
|
|
Thanks Very much for you reply.I have added two ports one remote port and second a local port and now its working fine
Regards
DilipRam
|
|
|
|
|
Could anyone tell me how to make it so the form window is always on top?
-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***
|
|
|
|
|
Hi Max,
The relevant properties would be Form.TopLevel and TopMost;
and there is the possibility to use ShowDialog() rather than Show().
It depends on what exactly it is you want.
|
|
|
|
|
max29297 wrote: The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program.
What version?
|
|
|
|
|
The Express ones by default download what they need, just a simple bootstrapper to start things going, you can download CD images of them though to burn.
|
|
|
|
|
THanks Ed!
|
|
|
|
|
max29297 wrote: THEREFORE I cannot install this program onto my pc.***
You can download a CD image of Visual C# Express and burn that to a CD so you don't have to be connected to the internet.
|
|
|
|
|
FYI: Full iso images of the express editions can be downloaded here. Unlike the bootstrappers you shouldn't need an internet connection to install.
http://msdn.microsoft.com/vstudio/express/support/install/[^]
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
How do you run an application within another application? I think it has something to do with the Process class...
-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***
|
|
|
|
|
one app can launch another app using the Process class,
the simplest approach is Process.Start("myfolder\\prog.exe");
more options are available by instantiating a Process object, and using StartInfo property.
The second process is a process in its own right, it does not run inside the first process
(whatever that would mean).
|
|
|
|
|
I need help in making a small program
I am trying to make a program that sits on the desktop never on top of anything unless it is called that is like a start button. when clicked it will open the start menu.
The only this is I need help getting the actual code that will bring it up.
Yesterday I saw a piece of code that will tell the computer that ctr + esc has been pressed when you click on it and it will open it up at where you click but it was in visual basic and I know C#
|
|
|
|
|
Post a link and some of us can help translate it if needbe if it does exactly what you want.
|
|
|
|
|
ok I'll try to find it again
|
|
|
|
|
I can't seem to find it again... dang I shoulda wrote that down...
but while I was trying to find it I found this too:
Visual basic (missing the link)
Private Const KEYEVENTF_KEYUP =
a delphi code peice:
http://delphi.about.com/cs/adptips2000/a/bltip1100_5.htm[^]
procedure TForm1.Button1Click(Sender: TObject) ;
begin
SendMessage(Form1.handle,
WM_SYSCOMMAND,
SC_TASKLIST,0) ;
end;
mabye I should learn how to give the computer a command saying ctrl + esc was pressed and to open it at the mouse.
|
|
|
|
|
You'll might be able to override the WndProc method of a form to do what you want, otherwise you can set up a global hook (articles here on CP about how to do that) but I don't think that you can use keys already in use, for example Ctrl+Esc, Start+R.
|
|
|
|
|
ok I'll try a global hook thnks
|
|
|
|
|
I am trying to open a filestream and have read only access to who ever tries to open the file after it has already been opened. This is the code I am using:
m_oFileStreamTest = new FileStream(l_szLocation, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
m_oZipFile = new ZipFile(m_oFileStreamTest);
This is the error I get when the second user tries to open the file:
"The process cannot access the file
'C:\..\...\..me.apts.resource.rld' because it is being used by another process"
What am I doing wrong?
|
|
|
|
|
RussBus wrote: What am I doing wrong?
Once you open the file for the first time you only permit others to read the file. But the file is being opened for read AND write, so it fails.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
How do I go about doing it then, so that the first person to use it gets Read and Write access?
|
|
|
|