How to update "list of trusted sources" in Lion Wiki Server 3
Hi,
I would like to integrate content of external webites in my Lion Server Wiki with the iframe-tag. When I save the code, nothing is shown and the src-fragment is deleted.
When I search the Wiki-Help, there is written something about a "list of trusted sources" in the wiki server.
In the client OS forum I found the same problem without an answer. Did anyone slove this problem?
I haven't used the previous OSX server versions before 10.7, but it seem to be a new technology than before, i.e.. ruby instead of python? Anyway, I've tried to create a whitelist.plist in all the directories mentioned but in 10.7 the major ones seems to be /etc/collabd and /usr/share/collabd, put whitelist.plist there don't work.
I also noted that when I added the iframe in the editor - it works, even more interesting, it works in the document history. From a security viewpoint - this is a bug as I see it.
Good thing is that I probably have a (unsecure) workaround, I edited the /etc/collabd/collabd.plist and change true to false regarding FilterEnabled and restarted Wiki
Like this:
<key>FiltersEnabled</key>
<false/>
But I reallly want some kind of whitelist from a security viewpoint, where is it?
Similar Messages
-
How to update list item metadata?
I want to implement lists.asmx > UpdateListItems method. In the update method (the caml) i would like to use barcode as a filter instead of item ID. http://msdn.microsoft.com/en-us/library/office/ms440289(v=office.14).aspx
How would my caml look like?
<Batch OnError="Continue" ViewName="CA28BFCC-4CCE-4EF8-B08F-7824535E13FC">
<Method ID="1" Cmd="Update">
<Field Name='BarCode'>6061114511</Field>
<Field Name="Title">New Title 2</Field>
</Method>
</Batch>Hi ,
You cannot use barcode as a filter instead of item ID by using OOTB list.asmx. You could build your own custom web service that uses the either the SPQuery class or linq and gather the items based on
a particular field value.
For more information, please take a look at the thread:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/af23f9f0-2640-474c-9616-522fcb639029/listserviceupdatelistitems-update-reference-field?forum=sharepointdevelopmentlegacy
I recommend that you update list items with listdata.svc.
Reference:
http://chuvash.eu/2011/12/15/update-list-items-with-listdata-svc/
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Tutorial on how to update list items using ListData.svc
Can you please point me to a tutorial which shows how to update a list item using listdata.svc and C#?
Sorry if this is FAQ.
I have found articles on read list... but I haven't found anything on update a list item.
val it: unit=()when i try this I get an error 500
I created an ASP.NET web application that allows the user to modify data that is stored in SharePoint I rather not go into the reasons why this application was created but focus more on why doesn't the listdata.svc allow me to update a task item that was
created by a workflow collect data from user action.
1. The workflow creates the item.
I collect the item and update the item using the below code. This is not an OOTB approval workflow that is just the name I used. When I get to save changes I received the following error code.
Dim getApprovalItem As ExpenseApprovalRuleBasedTasksItem = spContext.ExpenseApprovalRuleBasedTasks.Where(Function(i) i.Id = Pam.ApprovalItemID).FirstOrDefault
If String.IsNullOrEmpty(getApprovalItem.AuditorApprovalValue) Then
getApprovalItem.AuditingComments = approvalComments
Select Case approvalDecision
Case "Approved"
getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Approved")
getApprovalItem.AuditorApprovalValue = "Approved"
Case "Rejected"
getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Rejected")
getApprovalItem.AuditorApprovalValue = "Rejected"
End Select
getApprovalItem.Outcome = "Completed"
getApprovalItem.Status = ExpenseApprovalRuleBasedTasksStatusValue.CreateExpenseApprovalRuleBasedTasksStatusValue("Completed")
getApprovalItem.StatusValue = "Completed"
getApprovalItem.Complete = True
spContext.UpdateObject(getApprovalItem)
spContext.SaveChanges()
End If -
How to update list item using client object model without changing created/modified dates?
Hello All,
I want to update list item using the SharePoint Client Object
Model without updating the created / modified date. Is it possible?
Please help.
Thanks.Using the SystemUpdate method should do the trick, according
to its literature.
Additionally, would something like this be of any use for you? Taken from this
Stack Exchange thread: -
public static class SPListItemExtensions
/// <summary>
/// Provides ability to update list item without firing event receiver.
/// </summary>
/// <param name="item"></param>
/// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
public static void Update(this SPListItem item, bool doNotFireEvents)
SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
if (doNotFireEvents)
try
rh.DisableEventFiring();
item.Update();
finally
rh.EnableEventFiring();
else
item.Update();
/// <summary>
/// Provides ability to update list item without firing event receiver.
/// </summary>
/// <param name="item"></param>
/// <param name="incrementListItemVersion"></param>
/// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
public static void SystemUpdate(this SPListItem item, bool incrementListItemVersion, bool doNotFireEvents)
SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
if (doNotFireEvents)
try
rh.DisableEventFiring();
item.SystemUpdate(incrementListItemVersion);
finally
rh.EnableEventFiring();
else
item.SystemUpdate(incrementListItemVersion);
/// <summary>
/// Provides ability to update list item without firing event receiver.
/// </summary>
/// <param name="item"></param>
/// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
public static void SystemUpdate(this SPListItem item, bool doNotFireEvents)
SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
if (doNotFireEvents)
try
rh.DisableEventFiring();
item.SystemUpdate();
finally
rh.EnableEventFiring();
else
item.SystemUpdate();
private class SPItemEventReceiverHandling : SPItemEventReceiver
public SPItemEventReceiverHandling() { }
new public void DisableEventFiring()
base.DisableEventFiring();
new public void EnableEventFiring()
base.EnableEventFiring();
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
How to update calander in FDMEE source period mapping
Hi,
We are trying to find to update the calender in FDMEE source period mapping.
i have attached the screenshot. Once i selected the calendar MD(jan - Dec),the GL year details upto 2014 is coimg up where as 2015 is still missing.
We would like to know how to add 2015 year details....where this calendar is being maintained.
Our source is Peoplesoft General Ledger and target is "ARM".
Please advise.
Thanks,
RamanujamHi Ramanujam,
There are 3 methods to update the Calendar or defining the period
E-Business Suite and PeopleSoft calendars have these important elements:
Calendar—Identifier for a calendar
Start Date—Start date of the period
End Date—End date of the period
Refer the section "Define Period mappings" (Pg 102 - 108) in guide - http://docs.oracle.com/cd/E40248_01/epm.1112/erpi_admin.pdf
Thanks, -
How to update other infotype from source infotype via function module?
Want in source infotype to call a func.module, which shall update other infotype(s) in background.
Have tried out with HR_INFOTYPE_OPERATION, but without success - gives mitchmatch of source it and target it in the internal it buffer tables.
How to do?
Requirements also are to secure rollback, if update of the last of ex. 3 target its fails.
Anyone has experience on this issue?
Regards SørenKnow this functionality - also by means of own coding in the PAI by filling the int. tables dynmeas + initial_values. However the issue remains, i.e. the update has to be done by a function module called from PAI of own infotype, and from a function module you can't trigger the T588Z-functionality.
The update of it0003 from own it9300 is only an example, have general requirements that:
- from own infotype PAI a function module shall be called
- from the function module update of other infotypes
shall take place (modify as well as insert and delete)
- if more infotypes shall be updated from source infotype,
rollback shall take place if ex. update of last target
infotype fails (all to be updated or none!).
Regards Søren -
How to update List in Real time
Hallo, i have a little problema with the List component (spark). I linked that list with my database e adding and removing data from that list with addItem and removeItem. This works fine with List because the List items appears and disappers in real time after user events. My problem is when I update a item of the list. The name doesn'r change in real time as i want.. This is normal cause i have not a function like addItem and removeItem for updating my List.. What is this function??
Thanks and sry for bad english
MaxHallo, I am Max even if i write with my Friend account. I can't see any invalidateList() function, I only see invalidateDisplayList().. Why?
Thx
Max -
Hi,
I need to update some physical data service in ALDSP 2.5 on WLS 8.1 SP6 (8.1.6) via Static Mediator API from WebLogic Server 9.2 MP2 (9.2.2) application. I have reviewed the article about interoperability of ALDSP 2.5 and WLS 9 here:
http://edocs.bea.com/aldsp/docs25/appdev/ejbclt.html#wp1090900
Firstly, I had a problems with the interconnection between 9.2 client and ALDSP 2.5 due to some missed methods/classes. Finally, I've added the following libs to my WLS 9.2.2 pre-classpath in such an order:
MyDSPProject-ld-client.jar (built with Ant script using XmlBeans 2.0)
wlsdo.jar (from ALDSP 2.5)
xbean.jar
xqrl.jar
wlxbean.jar
ld-client.jar (from ALDSP 2.5)
I do the update in the way shown in attached java file.
After submit method call, I've got two copies of a new item added in the DB and also an exception that is shown in attached log-file.
What is the possible cause of this issue?
I use MySQL DBMS version 5.0.45.
I've also tried MS SQL 2005 but it simply had the same results.
DSP audit log is also attached.
Thank you in advance!
Best Regards,
Vitalii TiutiunnykThe problem is that your client is WLS server, and WLS server has network class loading disable (for security), and the result from the call requires a class that is not on the client. The call succeeds, but the the network class load for the result fails, and the WLS 9.2 framework (incorrectly) retries the call (and you get either a duplicate key exception or a second row inserted). Putting the server jar in the client classpath solves the problem.
If you wanted more information or help, you can contact BEA Customer Support and tell them it is regarding the CR I mentioned. -
How to update logic express 9.01 under lion?
After I installed Lion on my computer I recognized that i missed to update Logic express from 9.01 to 9.1, so the old version is not able to run under Lion. If I try now to update Logic express the system tells me to update from 9.01 what is recommended by the system.
Does anybody have the same problem?
Regards,
MI don't get the problem? Just perform the update from 9..0.1 to 9.1.6 by using "Software Update".
Best,
21 -
How to get list of roles decleared in the portal server 8.1
Hi,
I want to retrieve list of all the user security roles decleared in a portal application
programatically.
Can anyone help me in this?
Thanx
ManishSee http://edocs.bea.com/wlp/docs81/javadoc/index.html
and com.bea.p13n.entitlements.management.RolePolicyManager.
Pass EntitlementConstants.P13N_ROLE_POLICY_POOL
for the aResourceId. (Note javadoc return value is wrong).
public static String[] listRolesForResource(String anEntAppName,
String aWebAppName,
String aResourceId)-Phil"Manish
R" <[email protected]> wrote in message
news:3f4b7336$[email protected]..
>
Hi,
I want to retrieve list of all the user security roles decleared in aportal application
programatically.
Can anyone help me in this?
Thanx
Manish -
HT1338 How to update/edit auto fill in for lion
!@#$_
How do I find the place to edit autofil?
LION OS
Morgana048Is this for Safari?
If so, first place to try would be Safari > Preferences > Autofill.
charlie -
Update from 10.6.8 to Lion - Wiki not working
Hey everybody,
updated a server from 10.6.8 to 10.7.3 Lion server. Most of the data is working on the new server. iCal is working as expected, but the wiki didn't work.
Reimported the data with
wikiadmin migrate -r Backup/Collaboration -g wiki
or
wikiadmin migrate -r Backup/Collaboration
On the server page I see the imported wikis, but some of the site get back an error:
Routing Error
No route matches "/wiki/4c548/site.html"
Also none od the attachments are working The link is showing up as:
https://<server-address>/wiki/static/sandbox.html#
When hovering the file it show's the right filename
Anybody ideas? How can i clear the SQL database just for that wiki an reimport the data?
Thanks a lot!Here is the Update Log:
2012-04-18 14:23:36.302 wikiadmin[11541:307] Updating schema...
2012-04-18 14:23:36.305 wikiadmin[11541:307] Schema updates completed.
2012-04-18 14:23:36.305 wikiadmin[11541:307] Migrating...
2012-04-18 14:23:36.480 wikiadmin[11541:307] Migrating known users
2012-04-18 14:23:36.857 wikiadmin[11541:307] Generating placeholders for all known pages and wikis
2012-04-18 14:23:46.865 wikiadmin[11541:307] Found 181 pages belonging to 1 wikis and 9 users.
2012-04-18 14:23:46.866 wikiadmin[11541:307] Migrating project 'wiki' (1 of 1)
2012-04-18 14:24:06.958 wikiadmin[11541:307] Re-scanning 3 pages for pasted image/attachment URLs
2012-04-18 14:24:16.961 wikiadmin[11541:307] Copying content to real tables...
2012-04-18 14:24:24.163 wikiadmin[11541:307] Destroying migration entity and scratch tables...
2012-04-18 14:24:24.225 wikiadmin[11541:307] Done
2012-04-18 14:24:24.270 wikiadmin[11541:307] Importing user preferences
2012-04-18 14:24:34.273 wikiadmin[11541:307] Rebuilding search index...
2012-04-18 14:24:37.181 wikiadmin[11541:307] Done
2012-04-18 14:24:37.182 wikiadmin[11541:307] Migration complete
No error was given -.- -
How to list IP address from client on the Server (TCP/IP CLIENT SERVER COMMUNICATION)
Excuse me,
In this project I want to ask how to add list IP from client that connect to server.
I have edited slightly the project.
'SERVER
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Threading.Tasks
Imports System.Reflection
Public Class ServerForm
Private _Listener As TcpListener
Private _Connections As New List(Of ConnectionInfo)
Private _ConnectionMonitor As Task
Private Sub Button_Checked(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
If StartStopButton.Checked Then
StartStopButton.Text = "Stop"
StartStopButton.Image = My.Resources.StopServer
_Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
_Listener.Start()
Dim monitor As New MonitorInfo(_Listener, _Connections)
ListenForClient(monitor)
_ConnectionMonitor = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskContinuationOptions.LongRunning)
Else
StartStopButton.Text = "Start:"
StartStopButton.Image = My.Resources.StartServer
CType(_ConnectionMonitor.AsyncState, MonitorInfo).Cancel = True
_Listener.Stop()
_Listener = Nothing
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub ListenForClient(monitor As MonitorInfo)
Dim info As New ConnectionInfo(monitor)
_Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
End Sub
Private Sub DoAcceptClient(result As IAsyncResult)
Dim monitorinfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
If monitorinfo.Listener IsNot Nothing AndAlso Not monitorinfo.Cancel Then
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
monitorinfo.Connections.Add(info)
info.AcceptClient(result)
ListenForClient(monitorinfo)
info.AwaitData()
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Invoke(doUpdateConnectionCountLabel)
End If
End Sub
Private Sub DoMonitorConnections()
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Dim monitorInfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
Me.Invoke(doAppendOutput, "Server Started")
Do
Dim lostCount As Integer = 0
For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
Dim info As ConnectionInfo = monitorInfo.Connections(index)
If info.Client.Connected Then
If info.DataQueue.Count > 0 Then
Dim messageBytes As New List(Of Byte)
While info.DataQueue.Count > 0
Dim value As Byte
If info.DataQueue.TryDequeue(value) Then
messageBytes.Add(value)
End If
End While
Me.Invoke(doAppendOutput, "Message from IP: " + System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
End If
Else
monitorInfo.Connections.Remove(info)
lostCount += 1
End If
Next
If lostCount > 0 Then
Invoke(doUpdateConnectionCountLabel)
End If
_ConnectionMonitor.Wait(1)
Loop While Not monitorInfo.Cancel
For Each info As ConnectionInfo In monitorInfo.Connections
info.Client.Close()
Next
monitorInfo.Connections.Clear()
Invoke(doUpdateConnectionCountLabel)
Me.Invoke(doAppendOutput, "Server Stoped")
End Sub
Private Sub UpdateConnectionCountLabel()
ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ClearButton_Checked(sender As Object, e As EventArgs) Handles ClearButton.CheckedChanged
If ClearButton.Checked Then
RichTextBox1.Clear()
End If
End Sub
End Class
Public Class MonitorInfo
Private _listener As TcpListener
Public ReadOnly Property Listener As TcpListener
Get
Return _listener
End Get
End Property
Private _connections As List(Of ConnectionInfo)
Public ReadOnly Property Connections As List(Of ConnectionInfo)
Get
Return _connections
End Get
End Property
Public Property Cancel As Boolean
Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
_listener = tcpListener
_connections = connectionInfoList
End Sub
End Class
Public Class ConnectionInfo
Private _monitor As MonitorInfo
Public ReadOnly Property Monitor As MonitorInfo
Get
Return _monitor
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Get
Return _DataQueue
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Public Sub New(monitor As MonitorInfo)
_monitor = monitor
_DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
End Sub
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub AcceptClient(result As IAsyncResult)
_Client = _monitor.Listener.EndAcceptTcpClient(result)
If _Client IsNot Nothing AndAlso _Client.Connected Then
_Stream = _Client.GetStream
End If
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
End Sub
Private Sub DoReadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
info._LastReadLength = info.Stream.EndRead(result)
For Index As Integer = 0 To _LastReadLength - 1
info._DataQueue.Enqueue(info._Buffer(Index))
Next
'info.SendMessage("Data Diterima " & info._LastReadLength & " Bytes")
info.SendMessage("reply form server: " & info._LastReadLength & " Bytes")
For Each otherInfo As ConnectionInfo In info.Monitor.Connections
If Not otherInfo Is info Then
otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
End If
Next
info.AwaitData()
Else
info.Client.Close()
End If
Catch ex As Exception
info._LastReadLength = -1
End Try
End Sub
Private Sub SendMessage(message As String)
If _Stream IsNot Nothing Then
Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
Stream.Write(messageData, 0, messageData.Length)
End If
End Sub
End Class
'CLIENT
Imports System.Net
Imports System.Net.Sockets
Public Class ClientForm
Private _Connection As ConnectionInfo
Private _ServerAddress As IPAddress
Private Sub ClientForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ValidateChildren()
End Sub
Private Sub ConnectButton_Checked(sender As Object, e As System.EventArgs) Handles ConnectButton.CheckedChanged
If ConnectButton.Checked Then
If _ServerAddress IsNot Nothing Then
ConnectButton.Text = "Disconnect"
ConnectButton.Image = My.Resources.StopServer
Try
_Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
_Connection.AwaitData()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Connecting to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End Try
Else
MessageBox.Show("Invlid IP Server", "Cannt Connect to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End If
Else
ConnectButton.Text = "Connect"
ConnectButton.Image = My.Resources.StartServer
If _Connection IsNot Nothing Then _Connection.Close()
_Connection = Nothing
End If
End Sub
Private Sub SendButton_Click(sender As System.Object, e As System.EventArgs) Handles SendButton.Click
If _Connection IsNot Nothing AndAlso _Connection.Client.Connected AndAlso _Connection.Stream IsNot Nothing Then
Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(InputTextBox.Text)
_Connection.Stream.Write(buffer, 0, buffer.Length)
End If
End Sub
Private Sub ServerTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles IPTextBox.Validating
_ServerAddress = Nothing
Dim remoteHost As IPHostEntry = Dns.GetHostEntry(IPTextBox.Text)
If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
For Each deltaAddress As IPAddress In remoteHost.AddressList
If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
_ServerAddress = deltaAddress
Exit For
End If
Next
End If
If _ServerAddress Is Nothing Then
MessageBox.Show("Cannot resolve Server Address", "invalid Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
IPTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "invalid Port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub InvokeAppendOutput(message As String)
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Me.Invoke(doAppendOutput, message)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
RichTextBox1.Clear()
InputTextBox.Clear()
End Sub
End Class
Public Class ConnectionInfo
Private _AppendMethod As Action(Of String)
Public ReadOnly Property AppendMethod As Action(Of String)
Get
Return _AppendMethod
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub New(address As IPAddress, port As Integer, append As Action(Of String))
_AppendMethod = append
_Client = New TcpClient
_Client.Connect(address, port)
_Stream = _Client.GetStream
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoreadData, Me)
End Sub
Public Sub Close()
If _Client IsNot Nothing Then _Client.Close()
_Client = Nothing
_Stream = Nothing
End Sub
Private Sub DoreadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info._Stream IsNot Nothing AndAlso info._Stream.CanRead Then
info._LastReadLength = info._Stream.EndRead(result)
If info._LastReadLength > 0 Then
Dim message As String = System.Text.Encoding.ASCII.GetString(info._Buffer)
info._AppendMethod(message)
End If
info.AwaitData()
End If
Catch ex As Exception
info._LastReadLength = -1
info._AppendMethod(ex.Message)
End Try
End Sub
End Class
//ScreenShot server
http://prntscr[dot]com/5t1ol3
//Screenshot client
http://prntscr[dot]com/5t1odj
source: code[dot]msdn[dot]microsoft[dot]com/windowsdesktop/Simple-Multi-User-TCPIP-43cc3b44I have a similar chat application. When the user attempts to connect, instead of sending a simple string, the client sends a serialized object(xml string) with all relevant login and session information, this includes the user's IP address. Once the server
receives said information, depending on the type of TCP broadcast (a custom enumerated type) information from one user may be passed to a single user, or distributed to many users.
If it helps, here is the TCPBroadcast object I use. But in order for your server to understand it, you kind of have to build your server and client somewhat around it.
Option Strict On
Option Explicit On
Option Infer Off
Namespace TCPChat
Public Class TCPBroadcast
Public Property Message As String
Public Property BroadCastTime As DateTime
Public Property DestUser As String
Public Property OriginUser As String
Public Property PasswordHash As String
Public Property BroadcastSourceIP As String
Public Property BroadCastType As TCPBroadcastType
Public Property LoginUserName As String
Public Property FailureReason As String
Public Function XmlEncoding() As String
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim XML As String = String.Empty
Using memStream As New IO.MemoryStream
Using xmlWriter As New Xml.XmlTextWriter(memStream, System.Text.Encoding.UTF8) With _
{.Indentation = 4, .Formatting = System.Xml.Formatting.Indented}
serializer.Serialize(xmlWriter, Me)
End Using
XML = System.Text.Encoding.UTF8.GetString(memStream.ToArray)
End Using
Return XML
End Function
Public Function ToBinary() As Byte()
Return System.Text.Encoding.UTF8.GetBytes(Me.XmlEncoding)
End Function
Public Shared Function FromBinary(binary As Byte()) As DeserializationResult
Dim xml As String = System.Text.Encoding.UTF8.GetString(binary)
Return FromXML(xml)
End Function
Public Shared Function FromXML(xml As String) As DeserializationResult
Dim DeserializationResult As New DeserializationResult
DeserializationResult.Error = False
Try
Dim deserializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(xml)
Using memStream As New IO.MemoryStream(buffer)
DeserializationResult.tcpBroadCast = CType(deserializer.Deserialize(memStream), TCPBroadcast)
End Using
Catch ex As Exception
DeserializationResult.Error = True
DeserializationResult.ErrorMessage = ex.ToString
DeserializationResult.AttemptedXML = xml
End Try
Return DeserializationResult
End Function
Public Class DeserializationResult
Public [Error] As Boolean
Public ErrorMessage As String
Public tcpBroadCast As TCPBroadcast
Public AttemptedXML As String
Sub New()
End Sub
End Class
Public Enum TCPBroadcastType
AdministrativeMessage
AuthenticationFailure
AuthenticationSuccess
ChatBroadcast
CredentialsRequest
Credentials
DisconnectedByServer
KeepAlive
PrivateMessage
ServerMessage
SystemMessage
UnableToProcessRequest
End Enum
End Class
End Namespace
“If you want something you've never had, you need to do something you've never done.”
Don't forget to mark
helpful posts and answers
! Answer an interesting question? Write a
new article
about it! My Articles
*This post does not reflect the opinion of Microsoft, or its employees. -
How to list all active local ports where a server/services is listening?
How can I list all local ports where a local server or services is listening?
The listing should contain the path and program name of the listening server/service.
So I need something like:
port=22 /lib/svc/method/sshd
port=25 /bin/emailprgm
port=1049 /ust/local/bin/myserver
How can I do this?lsof (compile, sunfreeware.com, blaswave)
it wont show full path i think (man lsof for more) however it gives pids/ports/exe name, so you could take that and script it or do something with the output. -
I need help locating where and how to update Mac OS-X to Mountain Lion.....Thanx....Jay
First update your 10.6 version to 10.6.8 from the software update under the Apple Menu.
This will add direct access to the Mac App store via a new application.
Now launch the App Store from your Applications folder - Its the new icon a letter A formed from a ruler pencil and pen on a blue circle !
Once launched you need to add your iTunes account details or create an account add payment details etc...
Sign in purchase download and follow install processes to upgrade to 10.8 Mountain Lion.
OH and to be safe BEFORE you install backup your current system to an external drive !
Maybe you are looking for
-
Report designer is not coming up
Hi all, We have BI dual stack and we trying to activate Bex front end , i am able to execute Query designer but when i am opening report designer and trying to load any infocube i am getting Run time Java :.SS0 error. SSO is configured and betweeb Ja
-
This happens when I get an email with a link attached. Also, every single time I open up the NEW version, it defaults to the "welcome to Firefox 4" page. Is there a way to make it stop doing that too? Did I just download the new version too soon, bef
-
HT1349 The serial number on my new macbook is not recognised
I have just bought a new 13" Macbook Pro from Sydney Duty Free and have tried to register my Applecare Protection. It says my serial number is not recognised. I have called Apple support and they could not help me.
-
Hi all, First of all I live in Belgium so I cant preview any of this software: http://www.microsoft.com/en-us/powerbi/default.aspx Now most of my customers are SME in the fashion industry and we are going to develop a data warehouse platform where th
-
Can i open microsoft word documents in pages?
I need a word processor for college and if i can use pages instead of word then i can save a whole lot of money.