.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Imran Ghani
Post New Web Links

Sockets in Windows Forms, Server Hanging

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Windows Application
 
First off, I'm relatively new to C# but not programming.  I've written multiple connection apps in VB6 off and on for the last 8 years.  The problem with my server is that it hangs when ChatServer() is called and nothing appears in the rich text box.  I have no idea how to correct this or get it to start listening for connections, accept them, then retrieve data.  Pretty much learning as I go.  Here's the server so far: Any help would be greatly appreciated.   Edit:  I rewrote the server code using Winsock Control 6.0.  I know it's outdated but it's what I know and fairly well.  However, I noticed they did away with control array's!  What in the world?  Instead of setting a control's index property to 0, you now have to create references, objects, etc. etc.  SO much code for something so simple.  Anyway.  The problem now lies with the following code:   namespace Simple_Chat { public partial class frmServer : Form { int maxPlayers = 100; int index; public frmServer() { InitializeComponent(); } public void addToChat(string p, string fntcolor) { switch(fntcolor) { case "red": rtbMain.SelectionColor = Color.Red; rtbMain.SelectedText = p; break; case "blue": rtbMain.Selecti


View Complete Post


More Related Resource Links

Sockets in Windows Forms, Server Hanging

  
First off, I'm relatively new to C# but not programming.  I've written multiple connection apps in VB6 off and on for the last 8 years.  The problem with my server is that it hangs when ChatServer() is called and nothing appears in the rich text box.  I have no idea how to correct this or get it to start listening for connections, accept them, then retrieve data.  Pretty much learning as I go.  Here's the server so far: Any help would be greatly appreciated.   Edit:  I rewrote the server code using Winsock Control 6.0.  I know it's outdated but it's what I know and fairly well.  However, I noticed they did away with control array's!  What in the world?  Instead of setting a control's index property to 0, you now have to create references, objects, etc. etc.  SO much code for something so simple.  Anyway.  The problem now lies with the following code:   namespace Simple_Chat { public partial class frmServer : Form { int maxPlayers = 100; int index; public frmServer() { InitializeComponent(); } public void addToChat(string p, string fntcolor) { switch(fntcolor) { case "red": rtbMain.SelectionColor = Color.Red; rtbMain.SelectedText = p; break; case "blue": rtbMain.Selecti

ASP.NET Forms Authentication connecting to SQL Server with Windows Authentication

  
Hi everyone, I am not sure if this is the correct forum - apologies in advance - I could not identify where it should go! I have an ASP.NET Web Application that uses Forms Authentication using System.Web.Security.ActiveDirectoryMembershipProvider for signing on using Windows credentials.  This works nicely and is solid. The problem I have is connecting to SQL Server.  I need to be able to connect to SQL Server using Windows Authentication (trusted_connection=yes or Integrated Security=SSPI).  This is critical so I can record the user that created/last modified specific records and also to collect "Task-based" records that are relevant to the currently authenticated user. I have tried Google and a tonne of variations of web.config entries, using Win API to impersonate etc...  The only way that I could make it happen was to:- 1. Use the web.config entry:   (please entry at the bottom of the post.  For some reason it won't go into the right spot in this post!) 2. Log on specifically as the user specified in the above web.config entry.  If I log on as anyone else (ie Authenticate as anyone else), then SQL server simply gets the ASPNET service account as the Windows user. I have laboured over this for hours upon hours.  I really would appreciate some assistance. Thanks in Advance, Joe     "<identity

SQL Server 2005 random login failures for windows forms application

  

One of our VS .NET 2008 windows forms applications runs from multiple client machines. The application randomly has login failures from random machines and from random places in the code. The login works almost every time but about once every fifteen minutes an error shows up in SQL Server error logs from a random user. We are running a clustered SQL Server 2005 system and the database is in 2005 (90) mode.

The following error appears in the SQL Server error logs:

Login failed for 'App_Login'. [CLIENT: XXX.XXX.X.XXX] Error: 18456, Severity: 14, State: 16.

The following error is what the client sees:

How to hide SQL Server password from user in an Windows Forms Application?

  

Using - VS 2005, SQL Server 2005 Express, Windows Forms Application

Problem-

I am unable to find a way that hides the password to connect to database in case of a Windws Forms Application.

- app.config is accessible to the user, so connection strings an be read.

- app.config can't be encrypted as in case of ASP.NET applications

- hardcoding the password in the application in connectionstring still makes it possible to be discovered by a user


Vibhor Agarwal

C#, sockets, Windows and port 21 : A simple Client-server using TCP; connection dies after transfer

  

Hello,

I have a thread on Stackoverflow here:

http://stackoverflow.com/questions/4118800/c-networking-server-hangs-after-receiving-more-than-65535-bytes

In short: 

In a very VERY simple Client-Server solution the TCP connection dies after sending 65535 bytes. This only happens when I am connected on port 21. If I change the server port to for example port 22 the connection does not die.

I am posting the simple code here for reference.

CLIENT:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading;
using System.Net.Sockets;

namespace tWorks.Samcom.PassSocketPoller
{
  public class PollerTest2
  {
    private IPAddress _sutiSocketIpAddr;
    private int _sutiSocketPort;

    private Thread pollerThread = null

GC with Sockets in Windows 2008 server

  
Hello,

I'm experiencing a very strange problem with sockets that is specific to the 2008 server.

We have a service that polls every 10 seconds or so with a timer using a tcp socket:

Dim state As New StateObject(client)

client.BeginReceive(state.Buffer, 0, state.BufferSize, System.Net.Sockets.SocketFlags.None, New AsyncCallback(AddressOf ReceiveCallback), state)

For the most part the socket is already disconnected and disposed of before the asynchronous callback (resulting in a handled ObjectDisposedException):

client.Shutdown(System.Net.Sockets.SocketShutdown.Both)
client.Disconnect(True)
client.close(5)
client = Nothing

And we're finding that the Pool NonPaged Bytes increases with every iteration, showing that some resource is not being released. I've tried upgrading the project to use v3.5 of framework (as it is and to alter the process with the suggestions on http://msdn.microsoft.com/en-us/magazine/cc163356.aspx) but to no avail. As mentioned, this runs fine on everything but one server, which happens to be 2008.

Thanks in advance for any input,

Phil

Application Architecture in Windows Forms 2.0

  
Applications have special support in Windows Forms. For starters, you can manage and tailor your application's lifetime, and, when the work flow is disrupted by an unhandled exception, you can choose from several methods of response. Then, there are several application models that you can employ, including Single Document Interface (SDI) and Multiple Document Interface (MDI) applications, each of which can support either multiple-instance or single-instance mode, the former the VS05 default and the latter requiring special consideration. All applications, however, can discover and use a wide variety of information about the system and environment they execute in.

Application Architecture in Windows Forms 2.0-Single-MDI Applications

  
Consider an MDI application like Microsoft Excel; files opened from the file system (by double-clicking) are all opened as separate child windows within the parent Excel window.7 For the first instance of an MDI application to open a new child window to display the file that was passed to the second instance of the application, the second instance must be able to communicate with the initial instance.

Determine whether Forms Server is installed on a server

  
Check whether the Microsoft.Office.InfoPath.Server.dll and FormServer.aspx files are installed on the server.

How to programmatically add controls to Windows forms at run time by using Visual C#

  
Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:

How to Localize Windows Forms and Change the Language at Runtime

  
Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Localizing Windows Forms

  
The Visual Studio project system provides considerable support for localizing Windows Forms applications. There are two ways to generate resource files using the Visual Studio development environment: one is to have the project system generate the resource files for localizable UI elements such as text and images on the form. The resource files are then built into satellite assemblies. The second way is to add a resource file template and then edit the template with the XML Designer. A reason for doing the latter is to make localizable strings that appear in dialog boxes and error messages. You must then write code to access these resources.

This walkthrough topic demonstrates both processes in a single Windows Application project.

You can also convert a text file to a resource file; for more information, see Resources in Text File Format and Resource File Generator (Resgen.exe).

http://msdn.microsoft.com/en-us/library/y99d1cd3(VS.71).aspx

Word Automation Issue in Windows Server 2008 Hosting

  

Hi,

The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.


With Regards,

Ashok



No ASPNET User in Windows Server 2008?

  

I have been looking everywhere online regarding this, but have not found a clear answer.

 

I have an ASP.Net app running on Windows Server 2008, it's basically a reporting app using Crystal Reports. I have encountered a roadblock in regards to rendering some pages. When I run the app in Visual Studio(on the same 2008 machine) everything works perfectly. Yet when I publish it and run it live the reports will not display correctly, I get a message saying Failed to render page.

 

I looked this error up in the Crystal Reports website and the fixes they have there refer to giving the windows "aspnet" user full access rights to certain folders on the machine. I would be happy to do this, however there is no aspnet user in Windows Server 2008.

 

I installed the server and set its role to be Web Server. I also checked all the options regarding ASP.Net and IIS 6 compatibility. Yet there is no ASPNET username anywhere.

 

Did I set the server up wrong? or do I have to do something within ASP.Net to  create this user and then give it rights? 


Not working on Windows Server 2008

  

Hi,

 

I had the CSS friendly adapters working great on our old server (windows server 2003 - 32bit) and now we have moved to a 64 bit environment and now I can not get the CSS friendly adapters to work.

We are using SharePoint 2007.

Is there another work thru for 64bit environment.

I notice windows server 2008 has a directory  C:\Windows\Microsoft.NET\Framework64 would I be using the browser file in this directory???

Please help!


CLR Inside Out: Extend Windows Forms Apps Using System.AddIn

  

See how Windows Forms applications can be adapted to use the new .NET Add-in framework (System.AddIn) this month.

Mueez Siddiqui

MSDN Magazine July 2008


{ End Bracket }: Customize Windows Home Server

  

Chris Gray discusses custom applications he's developed for Windows Home Server and explores applications for energy savings.

Chris Gray

MSDN Magazine July 2008


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend