Monday, June 15, 2009

The Dynamic Language Runtime

The Dynamic Language Runtime (DLR) from Microsoft is an ongoing effort to bring a set of services that run on top of the Common Language Runtime (CLR) and provides language services for several different dynamic languages

Silverlight DLR is implemented on top of the CLR to allow both compilation and execution of dynamic code in runtime.
Without DLR, only the already-compiled code can execute. The good thing about DLR is that it can compile and execute code in Dynamic VB.NET, IronPython, IronRuby and Managed JScript—C# is not supported by the DLR yet—at a blazingly fast performance, as the dynamic code is first JIT-compiled before being executed. With DLR, we can now write dynamic code that can fully interact with Silverlight elements at runtime.
Supports the dynamic compilation and execution of scripting languages such as JavaScript and IronPython to program Silverlight-based applications. Includes a pluggable model for adding support for other languages for use with Silverlight.
  • The Silverlight Dynamic Languages SDK provides a bridge between Silverlight and the Dynamic Language Runtime (DLR). The SDK allows developers to use dynamic languages, running on the DLR, to build Silverlight applications. With this interoperation, dynamic languages can leverage the feature-rich Silverlight Framework Class Library (FCL), and dynamic languages can call into other dynamic languages, e.g., IronPython calling Managed JScript.
    The SDK also includes services to build new languages on top of the DLR, including a shared, dynamic type system and a language hosting model. It also facilitates hosting dynamic languages inside of different hosts. Silverlight can be viewed as "simply an application host used to host the DLR," using the same services that can be utilized by an application developer.
    To get started writing Silverlight applications in IronRuby, IronPython or Managed JScript, download the Silverlight Dynamic Languages SDK, which includes:
  • IronPython, IronRuby, and Managed JScript language libraries
  • Chiron, a dynamic language development utility
    source code for IronPython, IronRuby, the Dynamic Language Runtime (DLR), and Chiron sample applications for both Ruby and Python
  • batch file used to run sample on Windows
  • shell script to run applications on Mac
  • Microsoft® Public License (Ms-PL)

WCF

WCF Tutorial
Objectives:
• Review the role of interface-based programming
• Review the role of XML web services
• Define Service-Oriented Architectures (SOAs)
• Review the core distributed APIs of the Microsoft Windows OS
• Understand the motivation behind Windows Communication Foundation (WCF)
• Take a first look at building and testing WCF services
• Learn to create self-hosting WCF services
• Declaratively define hosting logic within *.config files
• Define hosting logic programmatically
• Understand the role of Metadata Exchange (MEX)
• Generate and make use of client proxies
• Learn to host WCF services in a Windows service
• Learn to host WCF services in IIS virtual directories
• Define and invoke ‘one-way’ method operations
• Learn to invoke WCF service methods asynchronously
Overview
Building a distributed system is a very common task for many programmers. However, doing so involves confronting numerous design challenges. In this chapter, you will review two key aspects of many distributed systems (interfaces and XML web services), followed by an overview of Service-Oriented Architectures (SOAs). Also, you will survey several core distributed APIs found within the Windows OS.With this historical background in place, the remainder of this chapter will introduce you to the Windows Communication Foundation (WCF) API. Here you will learn about the problems WCF attempts to solve, study the ABC’s (addresses, bindings, and contracts) of building a WCF application, and explore some common WCF development tools.The information presented here will function as the backbone for the remainder of the class.A Working Definition of Windows Communication Foundation (WCF)
• To begin your examination of WCF, you will start with a review of common distributed programming practices and previously distributed APIs.
• This is important, given that WCF leverages many of the distributed concepts / APIs you may have used in the past.
• WCF is a .NET 3.0 (and higher) API that allows you to build distributed systems.
• WCF is unique in that you can select from many types of bindings. This fact alone makes WCF a very flexible framework.
• A single WCF service could be exposed via an HTTP binding for outwardly facing callers or via a TCP binding for in-house callers.
• The underlying plumbing details can be relegated to *.config files, which make it very simple to change bindings and other details on the fly.
• WCF makes extensive use of interface-based programming techniques.
• When you define a WCF service, you typically begin by defining the interfaces that model the functionality callers can expect to find.
• These .NET interfaces could be used by the runtime to generate WSDL definitions based on your choice of bindings.
• In addition, WCF makes heavy use of .NET attributes to qualify how the runtime should handle client / service interactions.
• Similar to the .NET remoting layer / XML web services, WCF attributes are used to control data formatting, binding operations, and more.
• Recall that attributes are essentially code annotations.
• Attributes are useless unless another piece of software reflects over them. In this case, the ‘other piece of software’ could be the WCF runtime as well as WCF development tools.
• WCF is heavily influenced by XML web services and Service-Oriented Architectures (SOAs) in general.
• Like an XML web service, WCF services make use of contracts and explicit boundaries and support the use of various WS-* specifications.
• However, a WCF service does not have to use web-service-centric bindings.
• If you wish, you can opt for P2P bindings, named pipes, TCP bindings, and so on.
• The underlying binding is decoupled from the service itself.
• Therefore, changing bindings on the fly is very straightforward
.• In a nutshell, as of .NET 3.0 (and higher), WCF is the preferred way to build new distributed systems.
• The original distributed .NET APIs (System.Runtime.Remoting, System.Web.Services, and so forth) are still supported.
• Furthermore, Visual Studio still has templates for ‘traditional’ ASP.NET web service project workspaces.
• It is also possible to migrate existing XML web services / remoting applications into the WCF programming model.
• Doing so, however, may offer little benefit. In fact, it could entail a good amount of work.• This course does not cover migrating existing distributed systems into the WCF programming model.
• The class assumes you intend to build new WCF services, hosts, and clients.
• However, Appendix A illustrates how to interact with legacy COM+ components.
• You can read Appendix A if time / interest permits.
• The .NET Framework SDK documentation provides details of migrating existing systems.• If you are interested in migrating from .NET remoting to WCF, look up the article ‘From .NET Remoting to the Windows Communication Foundation (WCF)’.
• If you are interested in migrating from ASP.NET web services to WCF, look up the article ‘Migrating ASP.NET Web Services to WCF’.
• Finally, be aware that this class will focus on the core aspects of the programming model, which will be commonplace to all of your WCF projects.
• Consult the .NET Framework SDK documentation for WCF topics not addressed in this course.
• The WCF section of the SDK documentation provides a number of excellent code examples, white papers, and tutorials.• Simply look up the Windows Communication Foundation selection of the help system and dive in.

Sunday, June 14, 2009

CHIRON

What is Chiron?
The Chiron system provides tools for assisting in the development of graphical user interfaces and provides a run-time system for managing and supporting their dynamic behavior.
The objective of the Chiron system is to reduce long-term costs associated with developing and maintaining graphical user interface (GUI) software. It achieves this objective by providing key interface layers which are resilient to change. In particular, Chiron strongly separates an application from its user interface code, as well as separating the user interface code from the underlying toolkit substrates. Chiron supports the construction of GUIs which provide multiple coordinated views of application objects and allows flexible restructuring of the configuration of those views. Chiron supports a concurrent model of control. While the Chiron architecture supports heterogeneous, multi-lingual systems, the development tools which are part of this release only support clients (applications) written in Ada.
Chiron is a serverized system. The Chiron server and clients run in separate Unix processes. Within a client, artists are active interface agents that are bound to one or more objects. They encapsulate decisions about how objects should be depicted (presentations) as well as how they behave dynamically (dialogs). Multiple artists can be bound to a single object, providing coordinated multiple views of that object. A Chiron client is made up of application code, a set of artists, and client support code. The client support code implements initialization, event detection and routing, and communication with the server. Client support code is automatically generated by client building tools.
Chiron leverages from commercial GUI layout tools. Specifically, Chiron can be used with Sun Microsystem's DevGuide tool to create artists. For those aspects of GUIs which DevGuide is incapable of supporting (e.g. drawing on a canvas), DevGuide and Chiron tools can be used to create an artist template into which the additional graphical aspects can be added programmatically.
The Chiron server manages all aspects of the user interface that are not artist or application specific. It can be thought of as a virtual machine providing a high-level graphical "toolkit" interface to artists by means of an Abstract Depiction Language (ADL). The server receives ADL instructions from the artists and uses them to create and manipulate an internal abstract representation of the graphical interface. The representation is rendered to a concrete depiction (a user viewable image) via calls to the underlying window system. The server also listens for events from the window system (button push, menu selection, etc) and translates them to Chiron events before shipping them back to the appropriate client. The Chiron server provides flexibility in terms of windowing systems and toolkits, application languages, and process inter-connection topology. Although we currently only provide support for Ada clients, it is feasible to provide other language-specific interfaces to the server's ADL.
The Chiron model is highly concurrent. Most components maintain their own, and possibly multiple, threads of control. Thus, unlike most user interface architectures, Chiron avoids imposing sequential control upon tools, allowing the tool, the user interface, and the server, to run in parallel

USER CONTROL VS CUSTOM CONTROL

1) Custom controls are written in separate program files that are compiled explicitly and are persisted as an assembly (.dll).User controls are authored using the ASP.NET page syntax, either in the script block or in CodeBehind pages and are implicitly just-in-time compiled by the ASP.NET runtime system.
2) Custom Controls are nicely suited for general re-use as they are easy to package and redistribute as third-party controls. User Controls are best suited for reuse within a web application. Because they are persisted as source files, less chances exist that third parties would like to distribute them.
3) Once created, a custom control can be added to the toolbox of a visual designer, such as Visual Studio .NET, and dragged and dropped onto a page— just like any built-in server control. The visual designer can also support visual manipulation of custom control’s various properties.User controls provide minimal support for use with a visual designer toolbox.
4) A custom control provides minimal support for design-time authoring in a visual designer.A user control provides design-time support for authoring in a visual designer—just like an ASP.NET page.
5) A custom controls inherits System.Web.UI.Control or System.Web.UI.WebControls.WebControl class with class hierarchy (bottom up) either MyCustomControl.Control.Object OR MyCustomControl. WebControl.Control. Object.A user control inherits System.Web.UI.UserControl class with class hierarchy (bottom up) MyUserControl. UserControl. TemplateControl. Control. Object.
6) A custom control is in the form of dynamic linked library (.dll), thus pre-compiled.A user control has extension .ascx and is JIT compiled
7) A custom control does not have any design editor. It may or may not inherit functionality of other standard control(s). It can be an entirely new one.A user control must encapsulate functionality of other web server control(s) through dragging and dropping in design mode.
8 ) A custom control does not have design editor so is harder to create.A user control is easy to create because it can be designed like a page is designed i.e. they have design editor and code behind simultaneously
9) A custom control (newly created or extended) is a separate and pre-compiled component.A user control requires registration and instantiation per page and resides on a page as an object and is compiled along with the page. It is not in pre-compiled form
10) A custom control is more reusable because you do not need a separate copy of it for each application; it can automatically be loaded be from the GAC. Thus giving an advantage of being a framework wide component.A user control cannot be registered with Global Assembly Cache (GAC) .
11) A custom control’s class is not bound with any design. Here you can take the leverage of the flexibility and richness of .NET programming model; you can expose properties, override functions of the base class and also register complex client side logic in the class. A user control cannot provide the level of richness that a custom control can provide.
12) A custom control is the best choice especially when you want to make your controls redistributable, more reusable and make it a Visual Studio IDE aware component.A user control may fulfill your need if you are working on a single web application
13) A custom control cannot use the user control. A user control can use a custom control.
14) The custom control model is designed for authoring redistributable components in the form of an assembly (compiled class library) that can be used by a number of applications. The assembly containing the controls can be used by a single application at a time when placed in the application’s private bin directory, or it can be shared across multiple applications when placed into the global assembly cache, commonly referred to as the GAC. The assembly can be deployed and used in its compiled binary form without the associated source code.The user control model is designed for single-application scenarios. A user control is dynamically compiled at run time when a page that uses it is first requested. As a result, a user control must be deployed in source form, and the .ascx file (and its associated code-behind, if any exists) must be copied into every application that requires the user control.
15) Custom controls are authored by writing a managed class that derives directly or indirectly from System.Web.UI.Control in a .NET programming language.User controls are authored declaratively in the form of .ascx files, which is very similar to the way ASP.NET pages are designed and developed.

CUSTOM CONTROL

· Exist in precompiled assemblies.
· Code entirely contained in .cs (or .vb)
· No visual designer. Any HTML code needs to be declared programmatically.
· Can be used in .aspx pages, user controls or other custom server controls.
· Can be added to the ToolBox (drag and drop)
· Can be shared between web applications.

  • Reusability of control (or extend functionalities of existing control)
  • We can add toolbox
  • Just drag and drop from toolbox
  • U can register user control to. Aspx page by Register tag
  • A single copy of the control is required in each application
  • Good for dynamics layout
  • Hard to create
  • Compiled in to dll
  • You can create a Custom control when it is going to be used across different applications.
  • Custom controls don't a visual interface.
  • Custom controls however can be added to your tool box and used in different applications without re-compiling.
  • It's a .dll

USER CONTROL

· Have an ascx extension.
· Are compiled at runtime when the page is loaded.
· Visual design is possible, just like an aspx page and uses the ASP.Net page model with code behind file.
· Can only be used on a host aspx page or another user control.
· Cannot be added to the ToolBox.
· Can only be used in the current web application (source must be copied to another application to use).

  • We can’t add to toolbox
  • Just drag and drop from solution explorer to page (aspx)
  • U can register user control to. Aspx page by Register tag
  • A separate copy of the control is required in each application
  • Good for static
  • Easier to create8)
  • Not complied into DLL
  • Here page (user page) can be converted as control then We can use as control in aspx
  • Reusability web page

Wednesday, June 10, 2009

Animation in silverlight

Animation in silverlight
The Importance of an Impressive User Interface
Microsoft and other companies have invested millions of dollars in software research and development. The primary factors that affect and influence end users are performance and the user interface. The compilation of factors that influence the end user are referred to as the "user experience" (UX). Software developers are on a continual quest to improve application performance, however new rules and guidelines have recently been introduced that define higher standards for the creation of user interfaces. The new guidelines were primarily released by Microsoft and coincide with the release of Windows Vista, WPF, and, in turn, Silverlight.
Basically, the more impressed a user is with the overall user experience that an application provides, the more impressed they will be with the application and the more likely they will be to refer the application to others. This module, obviously, focuses on how to create user interfaces by using Silverlight.
Drawing Graphics
Silverlight is a subset of WPF as applied by using principles of an extended ASP.NET AJAX. As such, Silverlight implements many of the features included in WPF. For instance, Silverlight provides the ability to draw two-dimensional (2D) graphics in applications. Graphics of this caliber are more than adequate for most user interfaces and applications, particularly business applications. However, there are applications which require more elaborate graphic capabilities, three-dimensional graphics (3D). For example, an engineering application may benefit tremendously from 3D graphics in the user interface. Whilst WPF provides 3D graphics, Silverlight, currently, does not.
In order to provide 3D graphics, an application must utilize the hardware of the local workstation and the facilities of the local operating system. Silverlight is designed to be cross-platform and cross-browser compliant. With that in mind, it cannot be tied to any particular hardware configuration, operating system, or browser. This design coincides very well with the design goals of Silverlight but does not lend itself to rendering 3D graphics.
Silverlight, currently, does not support 3D graphics but may do so in a future version.
Graphic Elements
Drawing in Silverlight is accomplished through the use of graphic elements such as an ellipse or a rectangle. All graphic elements in Silverlight extend the Shape type. As a result, all Shape type objects in Silverlight include some common functionality as listed below:
Stroke: the stroke defines the outline of the shape
StrokeThickness: the stroke thickness defines the thickness of the outline of the shape
Fill: the fill defines how the interior of the shape is filled or painted
Lines
To draw lines in Silverlight, use the Line object. A line can easily be drawn on a canvas by using Blend and can be created directly in XAML by using Visual Studio 2008. A line is defined through the definition of two points. Each point is comprised of a combination of an X coordinate and a Y coordinate.
The markup snippet shown below is used to render a red, diagonal line from 10, 10 to 100, 100.
The canvas that results from the markup snippet above is shown in the following figure.
Ellipses
An Ellipse object is used to draw round objects in Silverlight. The circular characteristics of an ellipse are defined by specifying the height and width of the ellipse. The markup snippet shown below renders an oval ellipse with a blue gradient fill and a stroke of 3.
Sometimes, when using a graphical design tool, such as Blend, it may be tough to create an exact circle. To create a circle with a Silverlight ellipse, ensure that the height and width values are the same. To create a circle in Blend, when sizing the ellipse, hold down the Shift key. The markup snippet below renders a circle with a diameter of 100px, a stroke of 3, a green fill, and a yellow stroke.
The result of the two ellipse definitions above is shown in the figure below.
Rectangles
The Rectangle class is used to draw rectangles in Silverlight. The markup snippet below illustrates drawing two rectangles, a larger, blue rectangle in the background and a smaller, orange rectangle on top.
Just as with an ellipse, when sizing a rectangle by using Blend, if you want to draw a square or maintain the current aspect ratio of the rectangle, hold down the shift key. The result of the markup above is shown in the figure below.
Paths and Geometries
The Path object also derives from the Shape object, however, the Path object has no defined shape. Instead, a Path accepts an indirect or abstract definition of a shape to define how the Path is rendered. The Geometry class is used to define how a Shape is rendered. There is only one Path class but many types of Geometry classes. The Geometry class itself is an abstract class that cannot be directly instantiated but one of its child classes must be instantiated.
The Path class can be used to define simple shapes such as lines, ellipses, and rectangles in the same manner as the Line, Ellipse, and Rectangle classes, however the PathGeometry class is used to create more complex shapes. Creating paths can be rather tricky by hand coding the path coordinates directly in XAML. When using a design tool, such as Blend, paths are created as a combination of simpler elements or freehand by using a pen / pencil tool. The markup snippet below shows several path elements that were rendered in Blend when a sketchy little stick man was quickly drawn with the pencil tool.
The result of the markup shown above is shown in the following figure.
There are several types of geometries that can be utilized with a path including a LineGeometry, a RectangleGeometry, an EllipseGeometry, and a PathGeometry. The PathGeometry can compile complex shapes from multiple path segments. Path segments include arcs, béziers, lines, and variations of each.
The PathGeometry is used above in shorthand form. The Path object includes a Data attribute that accepts multiple coordinates to define points along the path. Upon closer look, you will notice that the Data attribute value also contains characters such as "M" or "C". The Data attribute value is actually a mini markup language and the characters are very meaningful as well as case-sensitive. For instance, an uppercase "M" signifies a move command and the coordinates that follow indicate the movement of the path.
Brushes
Brushes are used to paint spaces contained by a stroke, or border or the stroke itself. For instance, a brush can be used to paint the interior space of a rectangle. In fact, in the rectangles example above, a gradient brush is used to paint the interior of the rectangle as shown in the markup snippet below.
Brushes can be used to paint solid colors, gradients, images, and even video. The ability to paint with images is fairly common among graphic design tools, however the ability to paint with video is only available in a very few elite graphic tools. Expression Blend currently supports image and video brushes but only for WPF and not for Silverlight applications.
However, it's fairly easy to create an image brush fill as shown in the markup snippet below.
The result of the markup snippet above is shown in the following figure.
To paint by using video, a little more work is required. First, a VideoBrush does not directly play video but utilizes video from another source such as a MediaElement object. The MediaElement object is discussed again in the section below. In the example below, video is being played as the fore ground of text. The TextBlock.ForeGround utilizes a VideoBrush that, in turn, utilizes video from a MediaElement object.
The result of the markup above is shown in the figure below with video playing as text.
Transformations
Transformation objects are used to transform other Shape objects. There are various types of transformations including rotations, scales, skews, and translations. A scale is a resize. A skew transformation skews the shape of the Shape. A translate moves a shape.
The markup snippet below illustrates applying a 45 degree rotation to a TextBlock.

FAQ

http://www.dotnetfunda.com/articles/article293.aspx#What is XAML
http://www.dotnetfunda.com/misc/articles/default.aspx?start=300&page=6&cat=48&catname=Articles
http://www.dotnetfunda.com/articles/ShowCatArticle.aspx?category=83

link

Dependency properties provide support for value expressions, data binding, animation, and property change notification.
http://www.componentone.com/newimages/products/datasheets/studioforsilverlight.pdf
tutoral
http://www.dotnetfunda.com/tutorials/silverlight/animation.aspx

Delegate

Delegate
A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked
The signature of a single cast delegate is shown below:
delegate result-type identifier ([parameters]);
where:
result-type: The result type, which matches the return type of the function.
identifier: The delegate name.
parameters: The Parameters, that the function takes.
Delegates have the following properties:
• Delegates are similar to C++ function pointers, but are type safe.
• Delegates allow methods to be passed as parameters.
• Delegates can be used to define callback methods.
• Delegates can be chained together; for example, multiple methods can be called on a single event.
• Methods don't need to match the delegate signature exactly. For more information, see Covariance and Contravariance
• C# version 2.0 introduces the concept of Anonymous Methods, which permit code blocks to be passed as parameters in place of a separately defined method.

Tuesday, June 9, 2009

dll creation



STEPS
1.Start-Program-microsoft Visual studio 2008
2.File-New-New Project









2.1new->silverlightclasslibray












22.New folder->themes->Generic.xaml


2.3.







2.4.new folder->Button->Class.cs



















Monday, June 8, 2009

dll

What is a DLL?
A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Therefore, each program can use the functionality that is contained in this DLL to implement an Open dialog box. This helps promote code reuse and efficient memory usage.By using a DLL, a program can be modularized into separate components. For example, an accounting program may be sold by module. Each module can be loaded into the main program at run time if that module is installed. Because the modules are separate, the load time of the program is faster, and a module is only loaded when that functionality is requested.Additionally, updates are easier to apply to each module without affecting other parts of the program. For example, you may have a payroll program, and the tax rates change each year. When these changes are isolated to a DLL, you can apply an update without needing to build or install the whole program again.
The following list describes some of the files that are implemented as DLLs in Windows operating systems:
ActiveX Controls (.ocx) filesAn example of an ActiveX control is a calendar control that lets you select a date from a calendar.
Control Panel (.cpl) filesAn example of a .cpl file is an item that is located in Control Panel. Each item is a specialized DLL.
Device driver (.drv) filesAn example of a device driver is a printer driver that controls the printing to a printer.
DLL advantages
The following list describes some of the advantages that are provided when a program uses a DLL:
Uses fewer resources
When multiple programs use the same library of functions, a DLL can reduce the duplication of code that is loaded on the disk and in physical memory. This can greatly influence the performance of not just the program that is running in the foreground, but also other programs that are running on the Windows operating system.
Promotes modular architectureA
DLL helps promote developing modular programs. This helps you develop large programs that require multiple language versions or a program that requires modular architecture. An example of a modular program is an accounting program that has many modules that can be dynamically loaded at run time.
Eases deployment and installation
When a function within a DLL needs an update or a fix, the deployment and installation of the DLL does not require the program to be relinked with the DLL. Additionally, if multiple programs use the same DLL, the multiple programs will all benefit from the update or the fix. This issue may more frequently occur when you use a third-party DLL that is regularly updated or fixed.
DLL dependencies
When a program or a DLL uses a DLL function in another DLL, a dependency is created. Therefore, the program is no longer self-contained, and the program may experience problems if the dependency is broken.
For example, the program may not run if one of the following actions occurs:
A dependent DLL is upgraded to a new version.
A dependent DLL is fixed.
A dependent DLL is overwritten with an earlier version.
A dependent DLL is removed from the computer.
These actions are generally known as DLL conflicts. If backward compatibility is not enforced, the program may not successfully run.
The following list describes the changes that have been introduced in Microsoft Windows 2000 and in later Windows operating systems to help minimize dependency issues:
Windows File Protection
In Windows File Protection, the operating system prevents system DLLs from being updated or deleted by an unauthorized agent. Therefore, when a program installation tries to remove or update a DLL that is defined as a system DLL, Windows File Protection will look for a valid digital signature.
Private DLLs

Private DLLs let you isolate a program from changes that are made to shared DLLs. Private DLLs use version-specific information or an empty .local file to enforce the version of the DLL that is used by the program. To use private DLLs, locate your DLLs in the program root folder. Then, for new programs, add version-specific information to the DLL. For old programs, use an empty .local file. Each method tells the operating system to use the private DLLs that are located in the program root folder.
DLL troubleshooting tools
Several tools are available to help you troubleshoot DLL problems. The following tools are some of these tools.
Dependency Walker
The Dependency Walker tool can recursively scan for all dependent DLLs that are used by a program. When you open a program in Dependency Walker, Dependency Walker performs the following checks:

  • Dependency Walker checks for missing DLLs.
  • Dependency Walker checks for program files or DLLs that are not valid.
  • Dependency Walker checks that import functions and export functions match.
  • Dependency Walker checks for circular dependency errors.
  • Dependency Walker checks for modules that are not valid because the modules are for a different operating system.

By using Dependency Walker, you can document all the DLLs that a program uses. This may help prevent and correct DLL problems that may occur in the future. Dependency Walker is located in the following directory when you install Microsoft Visual Studio 6.0:
drive\Program Files\Microsoft Visual Studio\Common\Tools
DLL Universal Problem Solver
The DLL Universal Problem Solver (DUPS) tool is used to audit, compare, document, and display DLL information.

The following list describes the utilities that make up the DUPS tool:
Dlister.exe: This utility enumerates all the DLLs on the computer and logs the information to a text file or to a database file.
Dcomp.exe :This utility compares the DLLs that are listed in two text files and produces a third text file that contains the differences.
Dtxt2DB.exe : This utility loads the text files that are created by using the Dlister.exe utility and the Dcomp.exe utility into the dllHell database.
DlgDtxt2DB.exe :This utility provides a graphical user interface (GUI) version of the Dtxt2DB.exe utility.
For more information about the DUPS tool, click the following article number to view the article in the Microsoft Knowledge Base:
247957 (http://support.microsoft.com/kb/247957/ ) Using DUPS.exe to resolve DLL compatibility problems
DLL development
This section describes the issues and the requirements that you should consider when you develop your own DLLs.
Types of DLLs
When you load a DLL in an application, two methods of linking let you call the exported DLL functions. The two methods of linking are load-time dynamic linking and run-time dynamic linking.
Load-time dynamic linking
In load-time dynamic linking, an application makes explicit calls to exported DLL functions like local functions. To use load-time dynamic linking, provide a header (.h) file and an import library (.lib) file when you compile and link the application. When you do this, the linker will provide the system with the information that is required to load the DLL and resolve the exported DLL function locations at load time.
Run-time dynamic linking
In run-time dynamic linking, an application calls either the LoadLibrary function or the LoadLibraryEx function to load the DLL at run time. After the DLL is successfully loaded, you use the GetProcAddress function to obtain the address of the exported DLL function that you want to call. When you use run-time dynamic linking, you do not need an import library file.

The following list describes the application criteria for when to use load-time dynamic linking and when to use run-time dynamic linking:
Startup performanceIf the initial startup performance of the application is important, you should use run-time dynamic linking.
Ease of useIn load-time dynamic linking, the exported DLL functions are like local functions. This makes it easy for you to call these functions.
Application logicIn run-time dynamic linking, an application can branch to load different modules as required. This is important when you develop multiple-language versions.
The .NET Framework assembly
With the introduction of Microsoft .NET and the .NET Framework, most of the problems that are associated with DLLs have been eliminated by using assemblies. An assembly is a logical unit of functionality that runs under the control of the .NET common language runtime (CLR). An assembly physically exists as a .dll file or as an .exe file. However, internally an assembly is very different from a Microsoft Win32 DLL.An assembly file contains an assembly manifest, type metadata, Microsoft intermediate language (MSIL) code, and other resources. The assembly manifest contains the assembly metadata that provides all the information that is required for an assembly to be self-describing.

  • The following information is included in the assembly manifest:
  • Assembly name
  • Version information
  • Culture information
  • Strong name information
  • The assembly list of files
  • Type reference information
  • Referenced and dependent assembly information
    The MSIL code that is contained in the assembly cannot be directly executed. Instead, MSIL code execution is managed through the CLR. By default, when you create an assembly, the assembly is private to the application. To create a shared assembly requires that you assign a strong name to the assembly and then publish the assembly in the global assembly cache.

The following list describes some of the features of assemblies compared to the features of Win32 DLLs:
Self-describingWhen you create an assembly, all the information that is required for the CLR to run the assembly is contained in the assembly manifest. The assembly manifest contains a list of the dependent assemblies. Therefore, the CLR can maintain a consistent set of assemblies that are used in the application. In Win32 DLLs, you cannot maintain consistency between a set of DLLs that are used in an application when you use shared DLLs.
VersioningIn an assembly manifest, version information is recorded and enforced by the CLR. Additionally, version policies let you enforce version-specific usage. In Win32 DLLs, versioning cannot be enforced by the operating system. Instead, you must make sure that DLLs are backward compatible.
Side-by-side deploymentAssemblies support side-by-side deployment. One application can use one version of an assembly, and another application can use a different version of an assembly. Starting in Windows 2000, side-by-side deployment is supported by locating DLLs in the application folder. Additionally, Windows File Protection prevents system DLLs from being overwritten or replaced by an unauthorized agent.
Self-containment and isolationAn application that is developed by using an assembly can be self-contained and isolated from other applications that are running on the computer. This feature helps you create zero-impact installations.
ExecutionAn assembly is run under the security permissions that are supplied in the assembly manifest and that are controlled by the CLR.
Language independentAn assembly can be developed by using any one of the supported .NET languages. For example, you can develop an assembly in Microsoft Visual C#, and then use the assembly in a Microsoft Visual Basic .NET project.

msdn

http://msdn.microsoft.com/en-us/library/8wbhsy70.aspx

WEB SERVICES

What are web services?

  • Web services are application components
  • Web services communicate using open protocols
  • Web services are self-contained and self-describing
  • Web services can be discovered using UDDI
  • Web services can be used by other applications
  • XML is the basis for Web services

Web services platform elements:

  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)
    Web services can offer applications components like currency conversion, weather reports, or even language translation as services.
    Ideally, there will be only one type of each application component, and anyone can use it in their application.

    SOAP (Simple Object Access Protocol)
  • SOAP is a simple XML-based protocol to let applications exchange information over HTTP.
    Or more simple: SOAP is a protocol for accessing a Web Service.
  • SOAP stands for Simple Object Access Protocol
  • SOAP is a communication protocol
  • SOAP is a format for sending messages
  • SOAP is designed to communicate via Internet
  • SOAP is platform independent
  • SOAP is language independent
  • SOAP is based on XML
  • SOAP is simple and extensible
  • SOAP allows you to get around firewalls
  • SOAP is a W3C standard

What is WSDL?

  • WSDL is an XML-based language for describing Web services and how to access them.
  • WSDL stands for Web Services Description Language
  • WSDL is based on XML
  • WSDL is used to describe Web services
  • WSDL is also used to locate Web services
  • WSDL is a W3C standard

What is UDDI?

  • UDDI is a directory service where businesses can register and search for Web services.
  • UDDI stands for Universal Description, Discovery and Integration
  • UDDI is a directory for storing information about web services
  • UDDI is a directory of web service interfaces described by WSDL
  • UDDI communicates via SOAP
  • UDDI is built into the Microsoft .NET platform

FEATURES OF WPF

FEATURES OF WPF
Document
Ø is a class that can read documents
ØXAML documents can be updated on the fly and built at runtime.
ØExcellent example is using XSLT to create nice documents from simple markup tags.
ØDemo of Rich Reading Experience
Graphical Services
•All graphics, including desktop items like windows, are Direct3D applications.
ØSupports vector-based graphics, which allow lossless scaling.
ØSupports 3D model rendering and interaction in 2D applications.
•Interactive 2D content can be overlaid on 3D
surfaces, natively
3D Graphics
•Graphics in 3D are totally different with different controls/objects
•Viewport3D – a window into a 3D world
•Camera
•Objects
•Materials Brush
•Mesh






Media Services
ØWPF provides tighter integration with other features like user interface (UI), documents, and media. This makes it possible to have 3D UI, 3D documents, and 3D media.
ØThere is support for most common image formats.
ØWPF supports the video formats WMV, MPEG and some AVI files by default, but since it is Windows Media Player running beneath, WPF can use all the codecs installed for it.
ClearType & Antialiasing
•WPF supports ClearType fonts, which results in better readibility and comprehension.
•WPF also supports alti-aliasing, which rounds off rough pixel edges.












Data Binding
WPF has a built-in set of data services to enable application developers to bind and manipulate data within applications.
There exists support for three types of data binding:
Øone time: where the client ignores updates on the server.
Øone way: where the client has read-only access to data.
Øtwo way: where client can read from and write data to the server.
Multimedia
•Key feature of WPF and Silverlight allows integration of video, audio and speech
•TAG are
•Soundplayer (limited to WAV files only)
ØMediaPlayer (MP3 with full control)
ØMediaElement Video






















































Sunday, June 7, 2009

Resources

  • Resources
    Silverlight application is actually a package of files that's archived using ZIP compression and stored as a single file, with the extension .xap.
  • In a simple application, the XAP file has little more than a manifest (which list the files your project uses) and your application assembly. However, there's something else you can place in the XAP file—resources.
  • A XAP resource is a distinct file that you want to make available to your compiled application.
    Examples include graphical assets—images, sounds, and video files that you want to display in your user interface.
    · In the application assembly. The resource file is embedded in the compiled DLL file for your project, such as SilverlightApplication1.dll.
    · In the application package. The resource file is placed in the XAP file alongside your application assembly. It's still just as easy to deploy, but now it's a bit easier to manage, because you replace or modify your assets by editing the XAP file, without compiling your application.
    · On the site of origin. The resource file is placed on the website alongside your XAP file.
    Example, you can use images in ordinary HTML web pages, or make videos available for easy downloading. You can reduce the size of the initial XAP download, which is important if the resources are large.

RIA

Rich Internet Applications
Ø Rich Internet Application is a web application resembling the features of a desktop application
Ø A cross between browser-based Web applications and traditional desktop applications
Ø It provides an end user experience similar to client/server applications supported by rich graphical user interface.
BENEFITS OF RIA
Enhanced user experience:
· This ensures that customers are drawn to your specific web site because it is simple and functional.
· Users complete more transactions and forms because they understand the interface since it is very similar to standard windowing desktops and applications.
· Employees get more work done with less errors
Reduced server load:
· Due to the application being run in the users browser, there is a significant reduction in the
number of web page reloads – enhancing the user experience.
Lost data:
· No more lost user data due to users closing browser sessions or accidentally using the “back button”.
Real business benefits :
Ø Offer users a richer, more engaging experience
Ø Keep pace with users' rising expectations
Ø Increase customer loyalty and generate higher profits.
Ø Leverage existing personnel ,processes ,and infrastructure.
Ø Highly responsive performance and reduced network load.
Ø Higher, richer and easier levels of interactive functionality
Ø Cost-effective way to deliver modern application with real business benefits
Other benefits
Ø Provide real time data and inventory management.
Ø Allow users to remotely monitor and manage data via a Web-based system.
Ø Reduce data complexity -- allow users to interactively visualize and manipulate complex data more effectively and easily.
Ø Provide immediate and dynamic visual feedback to the user.
Ø Allow for quicker task completion.
Ø Provide cross platform support.
BENEFITS OF RIA IN SILVERLIGHT :
The emergence of new technologies such Silverlight not only take performance management to the next level, but also enables the user to benefit from 'rich' UI and enhanced performance at the same time.
These technologies facilitate the users in various ways are
Ø A technology widely known as 'no-refresh', where the transition from one set of information to another is instantaneous and visually more appealing
Ø No major installation required. Updating and distributing the application is an instant and automatic process
Ø Users can use the application from any computer equipped with an Internet connection regardless of the operating system running on that computer
Ø Web-based applications are generally less prone to viral infections contrary to the desktop applications.
Ø Any .Net programming language is used (c#, Ruby,Python,VB)
Ø .Net based browser plug-in for rich features (animation,vector graphics and audio-video).
Ø Silverlight is a great boost to the performance, providing a high-performance execution environment inside of the browser.
Ø Silverlight enables applications that run within multiple browsers and operating systems (Windows and Macintosh) and built on web standards for pogrammability such as JavaScript, CSS and XML and the .NET CLR.
Ø The CLR is the core piece of .NET Framework.
Ø The CLR is a well-proven high-performance platform providing features like Garbage Collection, Just-In-Time compilation, Exception Management and a wide array of fully featured languages such as VB.NET and C# that are used
Features
Windowing environment:
· Multiple processes occurring within an application (i.e. timers, data transmission and retrieval, video loading).
· Cross-browser compatibility
· Rapid development & deployment
· Re-use of existing style sheets (retention of original web site appearance and branding)
· Intuitive data presentation to users via charts, diagrams, video, audio and other formats
· Leverages existing web-based infrastructure to keep implementation costs low
· Re-use existing back-end databases – the only change is the way the data is presented to the user
FEATURES OF RIA :
Ø Run in a web browser, not requiring installation.
Ø Run locally in a secure environment called a sandbox.
Ø Users can use the application from any computer with an internet connection .
Ø Cross-platform availability
Ø Fast interface response time with no page refresh
Ø Common UI behaviors like drag & drop and the ability to work online and offline
Ø Common calculation that happens on the client (e.g., an insurance rate calculator)
Ø Instant update of the application
Applications
· Financial Services
· Auto Dealerships
· Mortgage Firms
· Customer survey forms
· Email forms
· Video Distribution (branding/licensing)
· Remote training services
· Customer service (live two-way video, chat & assistance)
· _Virtual Desktop Environments
· CRM/ERP front-end applications
RIA TOOLS
· Silverlight
· Flex
· AJAX (DOM with framework like GWT)
· Java FX
· OpenLazlo
· Macromedia Flash Player

Silverlight

SILVERLIGHT :
Ø A programming model for developing and distributing rich Internet applications (RIA) that use graphics, animations or video within the .NET framework. Silverlight was previously known by its code name, Windows Presentation Foundation
Ø Silverlight plug-in is both cross-browser and cross-platform Silverlight is based on the Microsoft .NET Framework and can be integrated with existing Web infrastructure and applications, including Apache and PHP, JavaScript and XHTML on the client. Using Silverlight, designers are able to prepare media for encoding and distribution, and create W3C standards-compliant sites.
Ø Silverlight is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications(RIA) for the web.
Ø It runs in all popular browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, Opera. The plugin required to run Silverlight is very small in size hence gets installed very quickly.
Ø It is combination of different technolgoies into a single development platform that allows you to select tools and the programming language you want to use.
Ø Silverlight integrates seamlessly with your existing Javascript and ASP.NET AJAX code to complement functionality which you have already created.
Ø Silverlight aims to compete with Adobe Flash and the presentation components of Ajax. It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight.
Currently there are 2 major versions of Silverlight:
Ø Silverlight 1.0 and Silverlight 2.0( previously referred to as version 1.1).
SILVERLIGHT 1.0:
Ø Silverlight 1.0, which was developed under the codename Windows Presentation Foundation/Everywhere (WPF/E), consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, Digital rights management, and DOM integration.
Ø Silverlight 1.0 is purely AJAX and Javascript based. All the code has to be written in Javascript and XAML
Ø Silverlight 1.0 consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, DRM support, and DOM integration.
Main features of Silverlight 1.0 :

Ø Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser.
Ø Silverlight supports the ability to progressively download and play media content from any web-server.
Ø Silverlight also optionally supports built-in media streaming.
Ø Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences.
Ø Silverlight makes it easy to build rich video player interactive experiences.
SILVERLIGHT 2.0 :
Ø Silverlight 2 supports managed code. When Silverlight 2 runtime is installed, it installs a limited version of .NET runtime on the client machine. This allows .NET programmers to write managed code to be executed on the client PC and provide a better user experience to the users. Of course, there is security and restrictions built in to it so that the code has limited access to the client computer.
Ø Developers must be aware that if the end user decline to install the .NET runtime on their client computer, the Silverlight 2 applications will not run.
Ø Silverlight 2.0 includes a version of the .NET Framework, with the full Common Language Runtime as .NET Framework 3.0; so it can execute any .NET language including VB.NET and C# code.
Ø Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process.
Ø With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic.
Ø This version ships with more than 30 UI controls(including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls), for two-way databinding support, automated layout management (by means of StackPanel, Grid etc) as well as data-manipulation controls, such as DataGrid and ListBox. UI controls are skinnable using a template-based approach.
Main features of Silverlight 2.0 :
Ø A built-in CLR engine that delivers a super high performance execution environment for the browser. Silverlight uses the same core CLR engine that we ship with the full .NET Framework.
Ø Silverlight includes a rich framework library of built-in classes that you can use to develop browser-based applications.
Ø Silverlight includes support for a WPF UI programming model. The Silverlight 1.1 Alpha enables you to program your UI with managed code/event handlers, and supports the ability to define and use encapsulated UI controls.
Ø Silverlight provides a managed HTML DOM API that enables you to program the HTML of a browser using any .NET language.
Ø Silverlight doesn't require ASP.NET to be used on the backend web-server (meaning you could use Silverlight with with PHP on Linux if you wanted to).
Ø Silverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Seadragon. It allows users to zoom into, or out of, an image (or a collage of images), with smooth transitions, using the mouse wheel. The images can scale from 2 or 3 megapixels in resolution into the gigapixel range, but the user need not wait for it to be downloaded entirely; rather, Silverlight downloads only the parts in view, optimized for the zoom level being viewed.
Ø Silverlight 2 also allows limited filesystem access to Silverlight applications. It can use the operating system's native file dialog box to browse to any file (to which the user has access).
How Silverlight would change the Web:
Ø Highest Quality Video Experience : prepare to see some of the best quality videos you have seen in your life, all embedded in highly graphical websites. The same research and technology that was used for VC-1, the codec that powers BluRay and HD DVD, is used by Microsoft today with its streaming media technologies.
Ø Cross-Platform, Cross-Browser : Finally build web applications that work on any browser, and on any operating system. At release, Silverlight will work with Mac as well as Windows! The Mono project has also already promised support for Linux!.
Ø Developers and Graphic Designers can play together! : Developers familiar with Visual Studio, Microsoft.net will be able to develop amazing Silverlight applications very quickly, and they will work on Mac's and Windows. Developers will finally be able to strictly focus on the back end of the application core, while leaving the visuals to the Graphic Design team using the power of XAML.
Ø Cheaper : Silverlight is now the most inexpensive way to stream video files over the internet at the best quality possible. Licensing is dead simple, all you need is IIS in Windows Server, and you’re done.
Ø Support for 3rd Party Languages : Using the power of the new Dynamic Language Runtime, developers will now be able to use Ruby, Python, and EcmaScript! This means a Ruby developer can develop Silverlight applications, and leverage the .net Framework!
Ø Cross-Platform, Cross-Browser Remote Debugging : If you are in the need to debug an application running on a Mac, no problem! You can now set breakpoints, step into/over code, have immediate windows, and all that other good stuff that Visual Studio provides.
Ø The best development environment on the planet : Visual Studio is an award winning development platform! As it continues to constantly evolve, so will Silverlight!
Ø Silverlight offers copy protection : Have you noticed how easy it is to download YouTube videos to your computer, and save them for later viewing ? Silverlight will finally have the features enabling content providers complete control over their rich media content! Streaming television, new indie broadcast stations, all will now be possible!
Ø Extreme Speed :There is a dramatic improvement in speed for AJAX-enabled websites that begin to use Silverlight, leveraging the Microsoft .net framework.

Getting Started With SilverLight :
In order to create Silverlight applications with following :
Runtime :
Microsoft Silverlight 2.0 : The runtime required to view Silverlight applications created with .NET Microsoft.
Developer Tools :
Microsoft Visual Studio 8.0 : The next generation development tool.
Microsoft Silverlight Tools for Visual Studio 2008 : The add-on to create Silverlight applications with Visual Studio 2008. This install will also install the Silverlight Developer Runtime and the Silverlight SDK. This add-on works with all versions of Visual Studio 2008 Service Pack 1, including Visual Web Developer.
Designer Tools :
Download the Expression designer tools to start designing Silverlight application.
Expression Blend 2.5The latest offering from Microsoft to create Silverlight content is Expression Blend
Software Development Kit:
Microsoft Silverlight Software Development Kit: Download this SDK to create Silverlight Web experiences that target Silverlight 2.0. The SDK contains documentation, tools, Silverlight ASP.NET controls and the libraries needed to build Silverlight applications.
Eclipse Tools for Silverlight : An Open Source, feature-rich and professional RIA application development environment for Microsoft Silverlight in Eclipse.

Thursday, June 4, 2009

Diff bet Managed VS Unmanaged

Ø Managed code is computer program code that executes under the management of a virtual machine,
Ø unlike unmanaged code, which is executed directly by the computer's CPU.
Ø The benefits of managed code include programmer convenience and enhanced security guarantees.
Ø The specific term managed code is most commonly used in connection with Microsoft's development environments, because Visual Studio is capable of compiling applications in both Managed and Unmanaged code.[1] [2] Microsoft's most common languages for creating managed code are C#, Visual Basic.NET and C++/CLI.
Ø Programs in any programming language could, in principle, be compiled into either managed or unmanaged code.
Ø Microsoft's Visual C++ development environment can produce both managed code (running under the .NET CLR)
Ø unmanaged code, running under the older MFC framework[2].

Ø Microsoft uses managed code in its CLR virtual machine in the .NET Framework, or another similar virtual machine.

Tuesday, June 2, 2009

CLOSING A SOCKET

CLOSING A SOCKET
•Close the remote host connection and releases all managed and unmanaged resources associated with the socket.
Shutdown()
•To close a socket first call Shutdown() of Socket object .
•Shutdown() finalizes any pending operation on the socket and then signals the remote host at the end-point that the connection should be closed
close()
•The close() to close connection
If(s.Connected)
{
s. Shutdown() ;
s.Close();
}

RECEIVING DATA FROM A SOCKET

RECEIVING DATA FROM A SOCKET
ØTo receive data from a socket ,use the ReceiveAsync() method
ØBegins an asynchronous request to receive data from a connected Socket object. \
ReceiveAsync()
ØNamespace: System.Net.SocketsAssembly: System.Net (in System.Net.dll)
C#
Øpublic bool ReceiveAsync( SocketAsyncEventArgs e)
STEPS
1.
ØCreate a byte array that can store data that is received on socket.
Øbyte[] response =new byte[1024];
2.
ØSet up the SocketAsyncEventArgs object that will be used to connect the socket to the remote host.
•SocketAsyncEventArgs arg = new SocketAsyncEventArgs();
arg.UserToken =s;
arg.RemoteEndPoint =ep;
3.
ØAttaching it to the SocketAsyncEventArgs object using SetBuffer()
ØSetBuffer accepts a byte array as 1st parameter,int offset as 2nd parameter and int length as 3rd parameter
•arg.SetBuffer(response,0, response.Lenth);
4.
ØOnReceivedCompleted() event handler to a SocketAsynEventArgs object
•arg.Completed+= new EventHandler
( OnReceivedCompleted);
5.
ØTo received data to remote host
ØReceivedAsync() method of the socket object and pass the SocketAsynEventArgs object
Øs. ReceivedAsync(arg);
6.
ØWhen data is received from the remote host the OnReceivedCompleted() event handler is called.

Monday, June 1, 2009

SENDING DATA ON A SOCKET

SENDING DATA ON SOCKET
ØSends data asynchronously to a connected Socket object.
ØThe SendAsync method is used to write outgoing data from one or more buffers on a connection-oriented socket.
STEPS
1.
ØNamespace: System.Net.Sockets
Assembly: System.Net (in System.Net.dll)
C#
Øpublic bool SendAsync( SocketAsyncEventArgs args)
2.
ØSet up the SocketAsyncEventArgs object that will be used to connect the socket to the remote host.
•SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.UserToken =s;
args.RemoteEndPoint =ep;
3.
ØThe data is send on the socket by using encoding the data into a byte buffer
• Byte[] b = Encoding.UTF8.GetBytes(“My Data”);
4.
ØSetBuffer() function accepts a bytes array a byte array as 1st parameter,int offset as 2nd parameter ,and int length as 3rd parameter.
•args.SetBuffer(b,0, b.Lenth);
5.
ØOnSendCompleted() event handler to a SocketAsynEventArgs object
•args.Completed+= new EventHandler(OnSendCompleted);
6.
ØSendAsync() method of the socket object and pass the SocketAsynEventArgs object
•S.SendAsync(args);
7.
•When data is send to remote host the OnSendCompleted() event handler is called.

OPENING A SOCKET TO REMOTE HOST

•STEPS
•1.Create an endpoint object that defines the address of the remote host
•Create DnsEndPoint object that points to port 4510 on host www.MySocketServer.com
•DnsEndPoint ep= new DnsEndPoint(www.MySocketServer.com,4510);
The DnsEndPoint class contains a host name or an IP address and remote port information needed by an application to connect to a service on a host. By combining the host name or IP address and port number of a service, the DnsEndPoint class forms a connection point to a service.
2.To create Socket Object use Constructor of Socket class .
ØSocket s = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,ProtocolType.Tcp);
Socket class Constructor takes three arguments
ØAddressFamily -Gets the Internet Protocol (IP) address family.
ØSocketType – Support only Stream
ØProtocolType - Support only TCP
3.Set up the SocketAsyncEventArgs object that will be used to connect the socket to the remote host.
ØSocketAsyncEventArgs sa = new SocketAsyncEventArgs();
sa.UserToken =s;
sa.RemoteEndPoint =ep;
4.Attact an event handler to handle the completed connection event
Øsa. Completed += new
EventHandler<>
(OnSocketConnectCompleted);
5.To open connection to remote host ,use
ConnectAsync() of socket object and pass the SocketAsyncEventArgs object
Øs. ConnectAsync(sa);

implementating socket in silverlight application

SOCKET:
SOCKET are bidirectional that meaning either side of communication is capable for both sending and reciving data.
IMPLEMENTATION OF SOCKET IN SILVERLIGHT APPLICATIONS
System.Net.Sockets Manages:
ØSystem.Net.Sockets library provides real-time duplex communication .
ØThe System.Net.Sockets namespace added in Silverlight version 2 provides a managed implementation of the sockets networking interface for developers who need to tightly control access to the network.
ØSystem.Net.Sockets namespace provides a managed implementation of the Windows Sockets (Winsock) interface.
ØSystem.Net.Sockets namespace provides a managed implementation of the sockets interface based on Berkeley Software Distribution (BSD) UNIX.

SILVERLIGHT SOCKET FRAMEWORK
ØDnsEndPoint - Represents a network endpoint as a host name of an IP address and a port number.
ØEndPoint - Identifies a network address. This is an abstract class.
ØIPAddress - Provides an Internet Protocol (IP) address.
ØIPEndPoint - Represents a network endpoint as an IP address and a port number.
ØSocketAddress - Stores serialized information from EndPoint derived classes.
SOCKET CLASS
ØNamespace:
System.Net.Sockets
Assembly: System (in System.dll)
DECLARATION :
Øpublic class Socket : IDisposable
ØThe Socket class provides a rich set of methods and properties for network communications.
ØThe Socket class allows you to perform both synchronous and asynchronous data transfer using any of the communication protocols listed in the
ProtocolType enumeration
SOCKET CLASS IN SILVERLIGHT:
ØSocket communication in silverlight applications must be done asynchronously.
ØIn the Socket class, asynchronous socket operations are described by reusable System.Net.Sockets.SocketAsyncEventArgs objects allocated and maintained by the application.

SOCKET OBJECT METHOD :
ØConnectAsync - Starts an asynchronous request for a connection to the remote host.
ØSendAsync - Writes outgoing data from one or more buffers on a connected socket.
ØReceiveAsync - Reads incoming data into one or more buffers from a connected socket.
ØShutdown - Finishes any pending send operations, and signals the remote endpoint that the connection should be closed. If Send is specified, data may still be received until the remote computer closes its end of the connection (indicated by receiving 0 bytes).
ØClose - Closes the remote host connection and releases all managed and unmanaged resources associated with the socket.

DISADV OF SOCKET IN SILVERLIGHT 2.0:
ØThe port range that a network application is allowed to connect to must be within the range of 4502-4534. These are the only ports allowed for connection using sockets from silverlight 2 applications.
ØIf a connection is to a port is not within this port range, the connection attempt will fail.